Russ,

Seeing as no one has actually answered your question as to why your IIF
isn't working, here's the reason.....

You say that if qryCustomer.allareas is FALSE then and only then you get
qryAreas.  This is the reason for your IIF not working.

When IIF is interpreted by the CF Server all parts of the function are
evaluated/generated.  This means that all the variables you use in the
function must be defined.  As you have a true response to
qryCustomer.allareas the query qryAreas has not been generated and the
variable qryAreas.name is not defined.

The correct syntax for your IIF is this :
#iif(qryCustomer.allareas,DE("All Areas"),DE(ValueList(qryAreas.name,',')))#

Although I don't necessarily agree that you should never use IIF, the above
would be better and neater done as a bit of cfscript or standard CF,
assigning the result to a variable which you use in your other CF tag. You
can even put a cfsilent around it if you're worried about white space.

<cfscript>
if (qryCustomer.allareas) TagVar = "All Areas";
else TagVar = ValueList(qryAreas.name);
</cfscript>

then just use TagVar instead of the whole IIF malarky...

Regards

Stephen
----- Original Message -----
From: "Ruslan Sivak" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Sunday, September 08, 2002 10:24 PM
Subject: iif usage


> Hi, I'm having a problem with iif.
>
> If I do
>
> #iif(qryCustomer.allareas,DE("All
> Areas"),DE("#ValueList(qryAreas.name,', ')#"))#
>
> and qryCustomer.allareas is true, therefore qryAreas is undefined (I
> check for it with an cfif somewhere else), then I get an error
> "Parameter 1 of function ValueList which is now "qryAreas.name" must be
> pointing to a valid query name"
>
> If I make it
>
> #iif(qryCustomer.allareas,DE("All Areas"),DE("ValueList(qryAreas.name,',
> ')"))#
>
> then it works fine in this case, but fails when qryCustomer.allareas is
> false as it doesn't evaluate the ValueList(qryAreas.name,', ')
>
> What am I doing wrong?
>
> Russ
>
> 
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to