Hi,
I'm trying to use IIF with DE, and it doesn't seem to be working. My code:
<cfset orderString = iif(isDefined("attributes.order"),
DE("&order=#attributes.order#"), "")>
<cflocation url="index.cfm?fuseaction=tools#orderString#>
What I am trying to do is this: if a certain variable is defined
(attributes.order), then create a string that can be appended to a URL,
otherwise make the string blank.
The desired results:
- If attributes.order is set to "name", then orderString should be set to
"&order=name"
- If attributes.order is undefined, then orderString should be set to ""
The problem is that when attributes.order is undefined, ColdFusion still
tries to execute the code that should be executed if the first expression
was true, thus giving an error. CF is trying to find the value of
attributes.order in the DE("&order=#attributes.order#") statement, even
though attributes.order is undefined, and that statement should go with
being evaluated.
This problem is kinda hard to explain, but does anyone have any idea on how
to fix this??? (without having to use CFIF/CFELSE - the whole point is that
I want to use IIF and DE)
Thanks
-Brent
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists