RE: iif usage

2002-09-09 Thread Tangorre, Michael

Dave,

I think Michael Dinowitz stated it if I recall correctly. I am not 100% sure.

Mike



-Original Message-
From: Dave Watts [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 09, 2002 2:43 PM
To: CF-Talk
Subject: RE: iif usage


> IIF has its place. Someone correct me if I am wrong, but I 
> thought I read on this list weeks ago that with MX, IIF was 
> just as fast as CFIF.

I don't think that's possible, although I could be wrong.

When you use IIf or Evaluate, you're evaluating a string as if it were an
expression. I suspect that this will always take longer than just evaluating
an expression.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444


__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
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



RE: iif usage

2002-09-09 Thread Dave Watts

> IIF has its place. Someone correct me if I am wrong, but I 
> thought I read on this list weeks ago that with MX, IIF was 
> just as fast as CFIF.

I don't think that's possible, although I could be wrong.

When you use IIf or Evaluate, you're evaluating a string as if it were an
expression. I suspect that this will always take longer than just evaluating
an expression.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

__
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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: iif usage

2002-09-09 Thread Tangorre, Michael

IIF has its place. Someone correct me if I am wrong, but I thought I read on this list 
weeks ago that with MX, IIF was just as fast as CFIF.
All languages have their fans in terms of language specifics and what to use and what 
not to use... if you do not like something, don't use it. If you like it and and the 
performance from your method is the best it can be, use it. So.

My 2 cents.

Mike 

-Original Message-
From: Joe Eugene [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 09, 2002 2:17 PM
To: CF-Talk
Subject: Re: iif usage


Good (humor) Sean...~! I agree there are bad practices...
(evaluate,cflocation, variable prefixes, spaghetti code and some others)
but i dont think you should include IIF in them...

Joe
- Original Message -
From: "Sean A Corfield" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, September 09, 2002 1:59 PM
Subject: Re: iif usage


> On Sunday, September 8, 2002, at 09:33 , Joe Eugene wrote:
> > I dont agree with Sean or Dave...
>
> That doesn't surprise me Joe :)
>
> > i dont think IIF is necessary but its
> > a very useful function ... "IF USED PROPERLY"
>
> I didn't say it wasn't *useful* - I just said it was bad practice and
> could always be avoided.
>
> > Many of you guys dont agree.. but i personally prefer using IIF and i
> > use it only when necessary... a good example would be...table row
colors.
> > ..
>
> It is NEVER necessary. You even admit that above!
>
> > i dont use the above for complex logic...write cfscript blocks of
code...
> > i am not very fond of  contructs...
>
> But you can structure your code to be concise without iif(). Since you
> want alternating colors, you should see that rownum mod 2 will give
> alternating 1, 0, 1, 0 values. So you could construct a two-element array
> containing the colors you want - do this above the loop over the table
> rows - and then each row just accesses the appropriate element of the
> array.
>
> The main benefit of this approach is that it keeps the color specification
> separate from the row logic instead of being embedded in the table and it
> also scales easily to alternately through more colors or alternating on
> blocks of rows.
>
> And of course it doesn't use iif() which is a big plus in my book.
>
> If you want to use iif() instead of , that's up to you. Just don't
> ask me for a job (or a reference)... :)
>
> Sean A Corfield -- http://www.corfield.org/blog/
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
> 

__
Get the mailserver that powers this list at http://www.coolfusion.com
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



Re: iif usage

2002-09-09 Thread Sean A Corfield

On Monday, September 9, 2002, at 11:16 , Joe Eugene wrote:
> Good (humor) Sean...~!

No humor at all.

> I agree there are bad practices...
> (evaluate,cflocation, variable prefixes, spaghetti code and some others)
> but i dont think you should include IIF in them...

Well, I've been dealing with code quality and software auditing for a long 
time. I can tell you that using iif() (and ?: in other languages) *is* bad 
practice. Like I say, if you don't believe me, I wouldn't hire you. It's 
very simple.

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

__
Get the mailserver that powers this list at http://www.coolfusion.com
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



RE: iif usage

2002-09-09 Thread Dave Watts

> Good (humor) Sean...~! I agree there are bad practices...
> (evaluate,cflocation, variable prefixes, spaghetti code 
> and some others) but i dont think you should include IIF 
> in them...

The IIf function evaluates string as expressions, as does the Evaluate
function. If you think the Evaluate function should be avoided, generally,
why wouldn't you think the same about the IIf function?

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
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



Re: iif usage

2002-09-09 Thread Joe Eugene

Good (humor) Sean...~! I agree there are bad practices...
(evaluate,cflocation, variable prefixes, spaghetti code and some others)
but i dont think you should include IIF in them...

Joe
- Original Message -
From: "Sean A Corfield" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, September 09, 2002 1:59 PM
Subject: Re: iif usage


> On Sunday, September 8, 2002, at 09:33 , Joe Eugene wrote:
> > I dont agree with Sean or Dave...
>
> That doesn't surprise me Joe :)
>
> > i dont think IIF is necessary but its
> > a very useful function ... "IF USED PROPERLY"
>
> I didn't say it wasn't *useful* - I just said it was bad practice and
> could always be avoided.
>
> > Many of you guys dont agree.. but i personally prefer using IIF and i
> > use it only when necessary... a good example would be...table row
colors.
> > ..
>
> It is NEVER necessary. You even admit that above!
>
> > i dont use the above for complex logic...write cfscript blocks of
code...
> > i am not very fond of  contructs...
>
> But you can structure your code to be concise without iif(). Since you
> want alternating colors, you should see that rownum mod 2 will give
> alternating 1, 0, 1, 0 values. So you could construct a two-element array
> containing the colors you want - do this above the loop over the table
> rows - and then each row just accesses the appropriate element of the
> array.
>
> The main benefit of this approach is that it keeps the color specification
> separate from the row logic instead of being embedded in the table and it
> also scales easily to alternately through more colors or alternating on
> blocks of rows.
>
> And of course it doesn't use iif() which is a big plus in my book.
>
> If you want to use iif() instead of , that's up to you. Just don't
> ask me for a job (or a reference)... :)
>
> Sean A Corfield -- http://www.corfield.org/blog/
>
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
>
> 
__
Get the mailserver that powers this list at http://www.coolfusion.com
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



RE: iif usage

2002-09-09 Thread Bryan Love

I agree with Sean.  IIF is slow and can ALWAYS be avoided.

I'm very fond of using the following syntax as Sean pointed out, except that
I use style sheet classes instead of arrays:



..


IIF screws up the color coding of the editor and looks messy and is also
difficult to immediately comprehend when scanning a page.  It really has no
place in well written code.

+---+
Bryan Love
  Macromedia Certified Professional
  Internet Application Developer
  Database Analyst
TeleCommunication Systems
[EMAIL PROTECTED]
+---+

"...'If there must be trouble, let it be in my day, that my child may have
peace'..."
- Thomas Paine, The American Crisis



-Original Message-
From: Sean A Corfield [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 09, 2002 11:00 AM
To: CF-Talk
Subject: Re: iif usage


On Sunday, September 8, 2002, at 09:33 , Joe Eugene wrote:
> I dont agree with Sean or Dave...

That doesn't surprise me Joe :)

> i dont think IIF is necessary but its
> a very useful function ... "IF USED PROPERLY"

I didn't say it wasn't *useful* - I just said it was bad practice and 
could always be avoided.

> Many of you guys dont agree.. but i personally prefer using IIF and i
> use it only when necessary... a good example would be...table row colors.
> ..

It is NEVER necessary. You even admit that above!

> i dont use the above for complex logic...write cfscript blocks of code...
> i am not very fond of  contructs...

But you can structure your code to be concise without iif(). Since you 
want alternating colors, you should see that rownum mod 2 will give 
alternating 1, 0, 1, 0 values. So you could construct a two-element array 
containing the colors you want - do this above the loop over the table 
rows - and then each row just accesses the appropriate element of the 
array.

The main benefit of this approach is that it keeps the color specification 
separate from the row logic instead of being embedded in the table and it 
also scales easily to alternately through more colors or alternating on 
blocks of rows.

And of course it doesn't use iif() which is a big plus in my book.

If you want to use iif() instead of , that's up to you. Just don't 
ask me for a job (or a reference)... :)

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood


__
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



Re: iif usage

2002-09-09 Thread Sean A Corfield

On Sunday, September 8, 2002, at 09:33 , Joe Eugene wrote:
> I dont agree with Sean or Dave...

That doesn't surprise me Joe :)

> i dont think IIF is necessary but its
> a very useful function ... "IF USED PROPERLY"

I didn't say it wasn't *useful* - I just said it was bad practice and 
could always be avoided.

> Many of you guys dont agree.. but i personally prefer using IIF and i
> use it only when necessary... a good example would be...table row colors.
> ..

It is NEVER necessary. You even admit that above!

> i dont use the above for complex logic...write cfscript blocks of code...
> i am not very fond of  contructs...

But you can structure your code to be concise without iif(). Since you 
want alternating colors, you should see that rownum mod 2 will give 
alternating 1, 0, 1, 0 values. So you could construct a two-element array 
containing the colors you want - do this above the loop over the table 
rows - and then each row just accesses the appropriate element of the 
array.

The main benefit of this approach is that it keeps the color specification 
separate from the row logic instead of being embedded in the table and it 
also scales easily to alternately through more colors or alternating on 
blocks of rows.

And of course it doesn't use iif() which is a big plus in my book.

If you want to use iif() instead of , that's up to you. Just don't 
ask me for a job (or a reference)... :)

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

__
Get the mailserver that powers this list at http://www.coolfusion.com
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



Re: iif usage

2002-09-09 Thread Stephen Moretti

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.


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


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



Re: iif usage

2002-09-08 Thread Joe Eugene

I dont agree with Sean or Dave... i dont think IIF is necessary but its
a very useful function ... "IF USED PROPERLY"
For me 

#IIF(expression... ," ", " ")#   is much more concise code
than writting...





Many of you guys dont agree.. but i personally prefer using IIF and i
use it only when necessary... a good example would be...table row colors...
i dont use the above for complex logic...write cfscript blocks of code...
i am not very fond of  contructs...

Joe


- Original Message - 
From: "Sean A Corfield" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, September 09, 2002 12:17 AM
Subject: Re: iif usage


> On Sunday, September 8, 2002, at 08:45 , Ruslan Sivak wrote:
> > Iif is necessary in certain cases.
> 
> No it isn't.
> 
> > Last time I checked, you can't use
> > cfif inside other cf tags...  (Maybe in mx you can).
> 
> You can always restructure such code to not need 'iif()'.
> 
> Sean A Corfield -- http://www.corfield.org/blog/
> 
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
> 
> 
__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
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



Re: iif usage

2002-09-08 Thread Sean A Corfield

On Sunday, September 8, 2002, at 08:45 , Ruslan Sivak wrote:
> Iif is necessary in certain cases.

No it isn't.

> Last time I checked, you can't use
> cfif inside other cf tags...  (Maybe in mx you can).

You can always restructure such code to not need 'iif()'.

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

__
Get the mailserver that powers this list at http://www.coolfusion.com
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



RE: iif usage

2002-09-08 Thread Kwang Suh

IIF is never necessary.

> -Original Message-
> From: Ruslan Sivak [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 08, 2002 9:45 PM
> To: CF-Talk
> Subject: RE: iif usage
> 
> 
> Iif is necessary in certain cases.  Last time I checked, you can't use
> cfif inside other cf tags...  (Maybe in mx you can). 
> 
> Russ
> 
> -Original Message-
> From: Sean A Corfield [mailto:[EMAIL PROTECTED]] 
> Sent: Sunday, September 08, 2002 8:48 PM
> To: CF-Talk
> Subject: Re: iif usage
> 
> On Sunday, September 8, 2002, at 02:24 , Ruslan Sivak wrote:
> > Hi, I'm having a problem with iif.
> 
> Don't use it. If you used cfif, you wouldn't be having these problems.
> You'
> ve got a boolean test and you set a string value which you then test
> later 
> (why not just use the same test or at least use a boolean type - fast - 
> instead of a more expensive string test?). iif() should be avoided in 
> almost all cases.
> 
> "If you're not annoying somebody, you're not really alive."
> -- Margaret Atwood
> 
> 
> 
__
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



RE: iif usage

2002-09-08 Thread Dave Watts

> Iif is necessary in certain cases. 

I can't think of a single case in which it's necessary. It's just another
way to perform conditional logic. If you have one way to perform conditional
logic, you can do anything you need, although it might be clumsier in some
situations than an alternative would be.

> Last time I checked, you can't use cfif inside other 
> cf tags...  (Maybe in mx you can). 

It depends on what you mean by "inside". For example, you can do this:


 ... some SQL goes here ...

 ... some conditional SQL goes here ...



However, even if you mean something else, you can always rewrite your
application to use CFIF - you can do your conditional logic before the CFML
tag which uses it, for example.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

__
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



RE: iif usage

2002-09-08 Thread Ruslan Sivak

Iif is necessary in certain cases.  Last time I checked, you can't use
cfif inside other cf tags...  (Maybe in mx you can). 

Russ

-Original Message-
From: Sean A Corfield [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, September 08, 2002 8:48 PM
To: CF-Talk
Subject: Re: iif usage

On Sunday, September 8, 2002, at 02:24 , Ruslan Sivak wrote:
> Hi, I'm having a problem with iif.

Don't use it. If you used cfif, you wouldn't be having these problems.
You'
ve got a boolean test and you set a string value which you then test
later 
(why not just use the same test or at least use a boolean type - fast - 
instead of a more expensive string test?). iif() should be avoided in 
almost all cases.

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood


__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
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



Re: iif usage

2002-09-08 Thread Joe Eugene

Russ,
You can do a little cheating here
 // where  u know the first
expression will evaluate "True"
set a default.. so in either case.. u have the variable
Joe

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


> That's the whole point, Joe... I have the following code above it
> 
> 
> somequery
> 
> 
>
> So therefore, qryAreas.name will only be defined if qryCustomer.allareas
> is false.
>
> I mean I have commented out the cfif above, so that the query runs in
> either case, but I'd still like to know how to get the iif to work the
> way I want it to.
>
> Russ
>
> P.S.  Yes, sorry about missing the single quotes in the middle.  I have
> the following code now, but still has the same problem if the qryAreas
> is not defined and qryCustomer.allareas is true:
>
> #iif(qryCustomer.allareas," 'All Areas' "," '#ValueList(qryAreas.name,',
> ')#' ")#
> -Original Message-
> From: Joe Eugene [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 08, 2002 6:32 PM
> To: CF-Talk
> Subject: Re: iif usage
>
> Carefully note the usage of single and double quotes.. there are there
> for a
> reason!
> and make sure... u have the query.columnName.. u are pointing..to
>
> #IIF(qryCustomer.allareas," 'All Areas' ","
> '#ValueList(qryAreas.name,',')#'
> ")#
>
>
> Joe
> - Original Message -
> From: "Ruslan Sivak" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Sunday, September 08, 2002 6:03 PM
> Subject: RE: iif usage
>
>
> > #iif(qryCustomer.allareas,"All Areas"," '#ValueList(qryAreas.name,',
> > ')#' ")#
> >
> > Doesn't work either.
> >
> > Parameter 1 of function ValueList which is now "qryAreas.name" must be
> > pointing to a valid query name
> >
> > Russ
> > -Original Message-
> > From: Joe Eugene [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, September 08, 2002 5:49 PM
> > To: CF-Talk
> > Subject: Re: iif usage
> >
> > qryCustomer.allareas should be a "0" or any number other than "0"
> which
> > is
> > True
> >
> > your statment should look like below.. u dont need "DE"
> >
> > #IIF(qryCustomer.allareas," 'All Areas' ","
> > '#ValueList(qryAreas.name,',')#'
> > ")#
> >
> > Which means if qryCustomer.allareas !=0 ...display "ALL Areas"
> > else
> > Display qryAreas.name list..
> >
> > Joe
> >
> >
> > - Original Message -
> > From: "Ruslan Sivak" <[EMAIL PROTECTED]>
> > To: "CF-Talk" <[EMAIL PROTECTED]>
> > Sent: Sunday, September 08, 2002 5: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
> > >
> > >
> >
> >
>
> 
__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
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



Re: iif usage

2002-09-08 Thread Sean A Corfield

On Sunday, September 8, 2002, at 02:24 , Ruslan Sivak wrote:
> Hi, I'm having a problem with iif.

Don't use it. If you used cfif, you wouldn't be having these problems. You'
ve got a boolean test and you set a string value which you then test later 
(why not just use the same test or at least use a boolean type - fast - 
instead of a more expensive string test?). iif() should be avoided in 
almost all cases.

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
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



RE: iif usage

2002-09-08 Thread Ruslan Sivak

That's the whole point, Joe... I have the following code above it
 

somequery



So therefore, qryAreas.name will only be defined if qryCustomer.allareas
is false.  

I mean I have commented out the cfif above, so that the query runs in
either case, but I'd still like to know how to get the iif to work the
way I want it to. 

Russ

P.S.  Yes, sorry about missing the single quotes in the middle.  I have
the following code now, but still has the same problem if the qryAreas
is not defined and qryCustomer.allareas is true:

#iif(qryCustomer.allareas," 'All Areas' "," '#ValueList(qryAreas.name,',
')#' ")#
-Original Message-
From: Joe Eugene [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, September 08, 2002 6:32 PM
To: CF-Talk
Subject: Re: iif usage

Carefully note the usage of single and double quotes.. there are there
for a
reason!
and make sure... u have the query.columnName.. u are pointing..to

#IIF(qryCustomer.allareas," 'All Areas' ","
'#ValueList(qryAreas.name,',')#'
")#


Joe
- Original Message -
From: "Ruslan Sivak" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Sunday, September 08, 2002 6:03 PM
Subject: RE: iif usage


> #iif(qryCustomer.allareas,"All Areas"," '#ValueList(qryAreas.name,',
> ')#' ")#
>
> Doesn't work either.
>
> Parameter 1 of function ValueList which is now "qryAreas.name" must be
> pointing to a valid query name
>
> Russ
> -Original Message-
> From: Joe Eugene [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 08, 2002 5:49 PM
> To: CF-Talk
> Subject: Re: iif usage
>
> qryCustomer.allareas should be a "0" or any number other than "0"
which
> is
> True
>
> your statment should look like below.. u dont need "DE"
>
> #IIF(qryCustomer.allareas," 'All Areas' ","
> '#ValueList(qryAreas.name,',')#'
> ")#
>
> Which means if qryCustomer.allareas !=0 ...display "ALL Areas"
> else
> Display qryAreas.name list..
>
> Joe
>
>
> - Original Message -
> From: "Ruslan Sivak" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Sunday, September 08, 2002 5: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
> >
> >
>
> 

__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
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



Re: iif usage

2002-09-08 Thread Joe Eugene

Carefully note the usage of single and double quotes.. there are there for a
reason!
and make sure... u have the query.columnName.. u are pointing..to

#IIF(qryCustomer.allareas," 'All Areas' "," '#ValueList(qryAreas.name,',')#'
")#


Joe
- Original Message -
From: "Ruslan Sivak" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Sunday, September 08, 2002 6:03 PM
Subject: RE: iif usage


> #iif(qryCustomer.allareas,"All Areas"," '#ValueList(qryAreas.name,',
> ')#' ")#
>
> Doesn't work either.
>
> Parameter 1 of function ValueList which is now "qryAreas.name" must be
> pointing to a valid query name
>
> Russ
> -Original Message-
> From: Joe Eugene [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 08, 2002 5:49 PM
> To: CF-Talk
> Subject: Re: iif usage
>
> qryCustomer.allareas should be a "0" or any number other than "0" which
> is
> True
>
> your statment should look like below.. u dont need "DE"
>
> #IIF(qryCustomer.allareas," 'All Areas' ","
> '#ValueList(qryAreas.name,',')#'
> ")#
>
> Which means if qryCustomer.allareas !=0 ...display "ALL Areas"
> else
> Display qryAreas.name list..
>
> Joe
>
>
> - Original Message -
> From: "Ruslan Sivak" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Sunday, September 08, 2002 5: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



RE: iif usage

2002-09-08 Thread Mike Townend

Try

#IIF(qryCustomer.allareas, DE('All Areas'),
DE('#ValueList(qryAreas.Name)#'))#

Havent tested it but it should work...

The downside of using an IIF() against an if() statement is that the
true and false sections are always evaluated... Whereas a normal if
statement if its true the false is not looked at...

HTH



-Original Message-
From: Ruslan Sivak [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, September 8, 2002 22:25
To: CF-Talk
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


__
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
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



RE: iif usage

2002-09-08 Thread Ruslan Sivak

#iif(qryCustomer.allareas,"All Areas"," '#ValueList(qryAreas.name,',
')#' ")#

Doesn't work either.

Parameter 1 of function ValueList which is now "qryAreas.name" must be
pointing to a valid query name

Russ
-Original Message-
From: Joe Eugene [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, September 08, 2002 5:49 PM
To: CF-Talk
Subject: Re: iif usage

qryCustomer.allareas should be a "0" or any number other than "0" which
is
True

your statment should look like below.. u dont need "DE"

#IIF(qryCustomer.allareas," 'All Areas' ","
'#ValueList(qryAreas.name,',')#'
")#

Which means if qryCustomer.allareas !=0 ...display "ALL Areas"
else
Display qryAreas.name list..

Joe


- Original Message -
From: "Ruslan Sivak" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Sunday, September 08, 2002 5: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



Re: iif usage

2002-09-08 Thread Joe Eugene

qryCustomer.allareas should be a "0" or any number other than "0" which is
True

your statment should look like below.. u dont need "DE"

#IIF(qryCustomer.allareas," 'All Areas' "," '#ValueList(qryAreas.name,',')#'
")#

Which means if qryCustomer.allareas !=0 ...display "ALL Areas"
else
Display qryAreas.name list..

Joe


- Original Message -
From: "Ruslan Sivak" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Sunday, September 08, 2002 5: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
>
> 
__
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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: iif usage

2001-01-27 Thread Max Paperno


>At 1/25/2001 06:13 PM +, Stephen Moretti wrote:


>#iif(isDefined("Attributes.display"),Trim(attributes.name&"_query.
>"&attributes.display),DE(''))#


This is good advice, and it will also not throw any errors if attributes.display is 
not defined.  For example:

IIf( IsDefined("attributes.foo"), DE("#attributes.foo#"), DE("") )  

would throw an error if attributes.foo wasn't defined, while

IIf( IsDefined("attributes.foo"), "attributes.foo", DE("") )  

would work as expected.

Cheers,
-Max


~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: iif usage

2001-01-25 Thread Katrina Chapman

I think you have 2 too many #'s in there.  You can also try

#iif(isDefined("Attributes.display"),DE(RTrim("#Chr(35)##attributes.name#_qu
ery.#
attributes.display##Chr(35)#")),DE(""))#

Chr(35) = #

Blessed Be,
--Katrina Chapman
http://www.katrinachapman.com
http://www.cfchick.com


-Original Message-
From: Ruslan Sivak [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 25, 2001 4:05 PM
To: CF-Talk
Subject: iif usage


I'm using iif, and running into some weird things.  Well first of all I'm
generating CF on the fly, so I need to escape # so that the variables don't
get evaluated until they are in the generated file.  For example I'm using
something like this.  Is this the right way to do it or is there an easier
way?

#iif(isDefined("Attributes.display"),DE(RTrim("#attributes.name#_query.#
attributes.display#")),DE(""))#

Do I really need the 5 pound signs?  Attributes.name is getting evaluated
right now, and so is attributes.display.  Lets say Attributes.name is
"first" and attributes.display" is "first_name" then it should return
#first_query.first_name#  with the pound signs around it.

Ruslan Sivak
Technologist
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: iif usage

2001-01-25 Thread Stephen Moretti

Ruslan,

>
> I'm using iif, and running into some weird things.  Well first of all I'm
> generating CF on the fly, so I need to escape # so that the
> variables don't
> get evaluated until they are in the generated file.  For example I'm using
> something like this.  Is this the right way to do it or is there an easier
> way?
>
> #iif(isDefined("Attributes.display"),DE(RTrim("#attributes.nam
> e#_query.#
> attributes.display#")),DE(""))#
>
> Do I really need the 5 pound signs?  Attributes.name is getting evaluated
> right now, and so is attributes.display.  Lets say Attributes.name is
> "first" and attributes.display" is "first_name" then it should return
> #first_query.first_name#  with the pound signs around it.
>


#iif(isDefined("Attributes.display"),Trim(attributes.name&"_query.
"&attributes.display),DE(''))#

will return the contents of the variable created from the bit in trim().
Put a DE() around the trim() and you'll get the variable name that was
created.

Regards

Stephen


~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists