Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF expression help!

Status
Not open for further replies.

NeoTurtle

Programmer
Aug 25, 2000
38
0
0
US
I have this:
_____________
<CFPARAM NAME=&quot;Attributes.width&quot; DEFAULT=&quot;150&quot;>

(more code)
...
(more code)

<CFSET tw = #IIf(IsDefined(Attributes.width), DE(&quot;#Attributes.width#&quot;), DE(&quot;100&quot;))#>
_____________
and I get this error:

Error Diagnostic Information
Parameter 1 of function IsDefined which is now &quot;150&quot; must be a syntactically valid variable name

The error occurred while evaluating the expression:


tw = #IIf(IsDefined(Attributes.width), DE(&quot;#Attributes.width#&quot;), DE(&quot;100&quot;))#



The error occurred while processing an element with a general identifier of (CFSET), occupying document position (180:3) to (180:86).
_____________

can anyone help?? Let me know if you need the rest of the code . . .

Thanks in advance,
-NeoTurtle [sig][/sig]
 


The problem your code faces is that it tries to deley the evaluation of attributes.width in the second parameter of the Iif function. This does not work out, since the second expression is evaluated due to the presence of # sign , and the original expression (IsDefined(Attributes.width)) does not get a chance to be evaluated.

It would be a better option to use CFIF...CFELSEIF statements in this case, eventhough they increase the number of code lines

regards

Perichazhi

[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top