[thelist] ColdFusion search results

Raymond Camden rcamden at allaire.com
Tue Dec 19 15:31:02 CST 2000


The IIF function can be a bit tricky. The first thing you pass to it is a
simple string to be evaluated. For example


<CFSET X = 2>

<CFOUTPUT>
#IIF(X is 2,DE("Yes"),DE("No"))#
</CFOUTPUT>

In the example above, the first arg, X IS 2, is evaluated. In this case, it
will be true, so the second arg to IIF is evaluated. If it was false, the
third arg would be evaluated. Ok, so what in the heck is DE? DE is short for
delayed evaluation. It means the IIF tag shouldn't be call the arg until
it's executed. That may not make sense. Look at this example:

<CFSET X= 1>
<CFOUTPUT>
#IIF(IsDefined("X"),DE("#X#"),DE("Not defined"))#
</CFOUTPUT>

In this example, if X wasn't defined, and I didn't use DE, I would get an
error.

Does this help much? By the way, IIF is a _slow_ function. You should almost
always use CFIF instead.

=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Allaire

Email   : jedimaster at allaire.com
ICQ UIN : 3679482

"My ally is the Force, and a powerful ally it is." - Yoda

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of Edd Partee
> Sent: Tuesday, December 19, 2000 2:53 PM
> To: thelist
> Subject: [thelist] ColdFusion search results
>
>
> CF Folk:
>
> I have a search results page returned from a Verity collection. If a
> file on the search results page is coming from a certain directory, I
> want it to load (when clicked) into a specific template. Otherwise, when
> clicked, the results links can load normally. I feel like this would be
> a job for the IIf function, but I don't know how in the H*** to use the
> IIf function. A little help?
>
> visual aid:
>
> collection               search results              when clicked
> sub directory 1          page x from sub dir 1       go to page x in sub
> dir 1
> sub directory 2          page y from sub dir 2       open page y from
> sub dir 2 in my template
>
>
> TIA
>
> Edd
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list