Iif() Evaluation Weirdness

2015-02-03 Thread Mosh Teitelbaum

All:

I've run into a problem that I could use some new eyes on... I have a function 
inside a CFC that accepts a query (importData) and a series of indicators 
(nicknameInd) that indicate if the value from the query should be used 
(indicator = 1) or not (indicator = 0).  In the below code, the first argument 
in the IIF() function evaluates to false (both conditions are false) so only 
the third argument, De(), should be evaluated.  However, for some reason, 
both the second and third arguments are being evaluated and I'm getting an 
error message that Element NICKNAME is undefined in IMPORTDATA. Because 
importData.nickname is not defined.

cfset variables.nickname = Iif( (arguments.nicknameInd NEQ 0) AND 
(IsDefined(importData.nickname)), De(importData.Nickname), De())

I've replaced both the second and third arguments with debugging code that 
showed that they are both being evaluated, regardless of the condition in the 
first argument.  Not sure why that is though given that they're both wrapped in 
DE() functions.

Any suggestions?

Thanks.

--
Mosh Teitelbaum



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360045
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Iif() Evaluation Weirdness

2015-02-03 Thread Mosh Teitelbaum

Dave Watts wrote:
  cfset variables.nickname = Iif( (arguments.nicknameInd NEQ 0) AND 
  (IsDefined(importData.nickname)),
  De(importData.Nickname), De())

 CF is going to verify that the variable exists, because you're referring to 
 it.

 That's what's happening here. Just because you're using the DE() function 
 doesn't mean that CF isn't going to evaluate importData.nickname at runtime
 to verify that there's actually something called importData.nickname in case 
 it needs to reference that value.

Dave:

Thanks for the reply.  My misuse of terminology aside, that would mean that the 
following cannot be converted to using IIF():

cfif IsDefined(importData.nickname)
cfset variables.nickname = importData.nickname
cfelse
cfset variables.nickname = 
/cfif

I thought the whole point of the DE() function was to delay evaluation of its 
argument until it was actually needed (e.g., when the IIF() function's first 
argument evaluates to true).  If not, then the only way to use a variable, that 
may not be defined, is by way of the full cfif treatment.  Is that right?

--
Mosh Teitelbaum


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360047
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Iif() Evaluation Weirdness

2015-02-03 Thread Dave Watts

 I've run into a problem that I could use some new eyes on... I have a 
 function inside a CFC that accepts a
 query (importData) and a series of indicators (nicknameInd) that indicate if 
 the value from the query should
 be used (indicator = 1) or not (indicator = 0).  In the below code, the first 
 argument in the IIF() function
 evaluates to false (both conditions are false) so only the third argument, 
 De(), should be evaluated. However,
 for some reason, both the second and third arguments are being evaluated and 
 I'm getting an error message
 that Element NICKNAME is undefined in IMPORTDATA. Because 
 importData.nickname is not defined.

 cfset variables.nickname = Iif( (arguments.nicknameInd NEQ 0) AND 
 (IsDefined(importData.nickname)),
 De(importData.Nickname), De())

 I've replaced both the second and third arguments with debugging code that 
 showed that they are both being
 evaluated, regardless of the condition in the first argument.  Not sure why 
 that is though given that they're
 both wrapped in DE() functions.

 Any suggestions?

The word evaluated here, I don't think it means what you think it means.

Whenever you have a CF statement, the entire statement is evaluated.
So, if you have something like this:

function(variable)

CF is going to verify that the variable exists, because you're referring to it.

That's what's happening here. Just because you're using the DE()
function doesn't mean that CF isn't going to evaluate
importData.nickname at runtime to verify that there's actually
something called importData.nickname in case it needs to reference
that value.

Dave Watts, CTO, Fig Leaf Software
1-202-527-9569
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Service-Disabled Veteran-Owned Small Business
(SDVOSB) on GSA Schedule, and provides the highest caliber vendor-
authorized instruction at our training centers, online, or onsite.

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360046
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Iif() Evaluation Weirdness

2015-02-03 Thread Russ Michaels

If you are going to use a variable that doesn't exist then using this
method will cause you issues as cf will still try to evaluate both sides of
it even if false.

There are ways round it using nested evaluate and de statements, but
frankly it just becomes messy and unreadable, I used to do this myself.
You are better off just using cfif or switch statement instead.


On Tue, Feb 3, 2015 at 19:32 PM, Mosh Teitelbaum mosh.teitelb...@evoch.com
wrote:


All:

I've run into a problem that I could use some new eyes on... I have a
function inside a CFC that accepts a query (importData) and a series of
indicators (nicknameInd) that indicate if the value from the query should
be used (indicator = 1) or not (indicator = 0).  In the below code, the
first argument in the IIF() function evaluates to false (both conditions
are false) so only the third argument, De(), should be evaluated.
However, for some reason, both the second and third arguments are being
evaluated and I'm getting an error message that Element NICKNAME is
undefined in IMPORTDATA. Because importData.nickname is not defined.

cfset variables.nickname = Iif( (arguments.nicknameInd NEQ 0) AND
(IsDefined(importData.nickname)), De(importData.Nickname), De())

I've replaced both the second and third arguments with debugging code that
showed that they are both being evaluated, regardless of the condition in
the first argument.  Not sure why that is though given that they're both
wrapped in DE() functions.

Any suggestions?

Thanks.

--
Mosh Teitelbaum





~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360048
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Iif() Evaluation Weirdness

2015-02-03 Thread Mosh Teitelbaum

Thanks Russ (and Dave).

That's the route I ended up going to.  Kind of annoying as I think the Iif() 
method produces cleaner code (and I had already written it) but it is what it 
is.

--
Mosh Teitelbaum

Russ Michaels wrote
 If you are going to use a variable that doesn't exist then using this method 
 will cause you issues as cf will still try to evaluate both sides of it even 
 if false.

 There are ways round it using nested evaluate and de statements, but frankly 
 it just becomes messy and unreadable, I used to do this myself.
 You are better off just using cfif or switch statement instead.


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360049
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Iif() Evaluation Weirdness

2015-02-03 Thread Dave Watts

   cfset variables.nickname = Iif( (arguments.nicknameInd NEQ 0) AND
   (IsDefined(importData.nickname)),
   De(importData.Nickname), De())
 
  CF is going to verify that the variable exists, because you're referring to 
  it.
 
  That's what's happening here. Just because you're using the DE() function 
  doesn't
  mean that CF isn't going to evaluate importData.nickname at runtime
  to verify that there's actually something called importData.nickname in 
  case it needs
  to reference that value.

 Thanks for the reply.  My misuse of terminology aside, that would mean that 
 the
 following cannot be converted to using IIF():

 cfif IsDefined(importData.nickname)
 cfset variables.nickname = importData.nickname
 cfelse
 cfset variables.nickname = 
 /cfif

 I thought the whole point of the DE() function was to delay evaluation of its 
 argument
 until it was actually needed (e.g., when the IIF() function's first argument 
 evaluates to
 true).  If not, then the only way to use a variable, that may not be defined, 
 is by way of
 the full cfif treatment.  Is that right?

No, that's not entirely right. But the CFIF is more readable, so you
might want to go with that anyway. Honestly, I find IIF to be hard to
read a lot of the time, so I try to avoid it.

Now that you have a corresponding CFIF, it's a bit clearer to me what
you're trying to do. Here's how you'd do that, I think, in IIF:

cfset variables.nickname = iif(arguments.nicknameInd neq 0 and
isDefined(importData.nickname), importData.nickname, )

(note, I haven't tested this because I'm not in my office)

The IIF function will automatically evaluate the last two arguments
and return their values, but you'll notice that the arguments
themselves are strings. Your second argument doesn't actually refer to
the variable until that branch is executed. Does that make sense?

Dave Watts, CTO, Fig Leaf Software
1-202-527-9569
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Service-Disabled Veteran-Owned Small Business
(SDVOSB) on GSA Schedule, and provides the highest caliber vendor-
authorized instruction at our training centers, online, or onsite.

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360050
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Iif() Evaluation Weirdness

2015-02-03 Thread Russ Michaels

Well if you want to try it out then try using nested evaluate(de(''))
You can also achieve same using nested quotes like de('stuff') to avoid
evaluation,
But it just gets messy imho
Iif() has its uses for simple inline evaluations, such as select lists or
dynamic style classes but beyond that I think it just makes for better code
not to do it inline.


On Wed, Feb 4, 2015 at 0:21 AM, Mosh Teitelbaum mosh.teitelb...@evoch.com
wrote:


Thanks Russ (and Dave).

That's the route I ended up going to.  Kind of annoying as I think the
Iif() method produces cleaner code (and I had already written it) but it is
what it is.

--
Mosh Teitelbaum

Russ Michaels wrote
 If you are going to use a variable that doesn't exist then using this
method will cause you issues as cf will still try to evaluate both sides of
it even if false.

 There are ways round it using nested evaluate and de statements, but
frankly it just becomes messy and unreadable, I used to do this myself.
 You are better off just using cfif or switch statement instead.




~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360051
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


iif

2009-07-20 Thread RamaDevi Dobbala

cfquery datasource=askseaton name=get_offices1 result=log
select s.office_name,u.userid,s.lead_mgr,iIf(u.userid = s.lead_mgr, 
u.first , s.lead_note )  as leadMgr
from sourcebook_1 s ,user_info u 
where s.active = 1 
and office_id not in(36,37,38,73)
order by s.office_number
/cfquery

is this is correct comparision,please tell me 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324714
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: iif

2009-07-20 Thread Francois Levesque

IIF is a ColdFusion method, you can't use it in SQL like that. What you're
probably looking for is CASE:

CASE WHEN u.userid = s.lead_mgr THEN u.first ELSE s.lead_note END AS leadMgr

Francois Levesque
http://blog.critical-web.com/


On Mon, Jul 20, 2009 at 9:31 AM, RamaDevi Dobbala ramadobb...@gmail.comwrote:


 cfquery datasource=askseaton name=get_offices1 result=log
select s.office_name,u.userid,s.lead_mgr,iIf(u.userid = s.lead_mgr,
 u.first , s.lead_note )  as leadMgr
from sourcebook_1 s ,user_info u
where s.active = 1
and office_id not in(36,37,38,73)
order by s.office_number
 /cfquery

 is this is correct comparision,please tell me

 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324715
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: iif

2009-07-20 Thread RamaDevi Dobbala

ya my case should be like that, but i need to pass that result to the cfgrid, 
along with some ohter rows 

IIF is a ColdFusion method, you can't use it in SQL like that. What you're
probably looking for is CASE:

CASE WHEN u.userid = s.lead_mgr THEN u.first ELSE s.lead_note END AS leadMgr

Francois Levesque
http://blog.critical-web.com/


On Mon, Jul 20, 2009 at 9:31 AM, RamaDevi Dobbala ramadobb...@gmail.comwrote:

 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324717
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Outputting a hash character in an IIF() function.

2008-01-09 Thread Tom Chiverton
On Wednesday 09 Jan 2008, Ian Skinner wrote:
 I'm having trouble with this and the usual tricks don't seem to be working.
 #iif(bgFlag,DE(' style=background-color: #DDFFDD'),DE(''))#

Why not just rewrite it so as not to use iif or de ?

-- 
Tom Chiverton
Helping to administratively architect scalable CEOs
on: http://thefalken.livejournal.com



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at 
Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list 
of members is available for inspection at the registered office. Any reference 
to a partner in relation to Halliwells LLP means a member of Halliwells LLP.  
Regulated by The Solicitors Regulation Authority.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 2500.

For more information about Halliwells LLP visit www.halliwells.com.

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296241
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Outputting a hash character in an IIF() function.

2008-01-09 Thread Ian Skinner
I'm having trouble with this and the usual tricks don't seem to be working.

#iif(bgFlag,DE(' style=background-color: #DDFFDD'),DE(''))#

This fails. I have tried escaping the internal hash character by 
doubling.  I have tried to concatenate chr(35).  Everything I do throws 
exceptions involving invalidly paired hash characters.

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296238
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Outputting a hash character in an IIF() function.

2008-01-09 Thread Dave
Have you tried assigning it to a variable in a cfset and then displaying the
variable.  Alternately, convert to RGB:  style=background-color:rgb(221 255
221)'

 -Original Message-
 From: Ian Skinner [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, January 09, 2008 9:34 AM
 To: CF-Talk
 Subject: Outputting a hash character in an IIF() function.
 
 I'm having trouble with this and the usual tricks don't seem 
 to be working.
 
 #iif(bgFlag,DE(' style=background-color: #DDFFDD'),DE(''))#
 
 This fails. I have tried escaping the internal hash character 
 by doubling.  I have tried to concatenate chr(35).  
 Everything I do throws exceptions involving invalidly paired 
 hash characters.
 
 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296253
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Outputting a hash character in an IIF() function.

2008-01-09 Thread Ian Skinner
Tom Chiverton wrote:
 On Wednesday 09 Jan 2008, Ian Skinner wrote:
   
 I'm having trouble with this and the usual tricks don't seem to be working.
 #iif(bgFlag,DE(' style=background-color: #DDFFDD'),DE(''))#
 
 Why not just rewrite it so as not to use iif or de ?
Generally because I prefer to KNOW why I have to replace one clear line 
of code with 5 lines of slightly less clear code that requires the using 
a few bits more memory to store a variable I will not use any place else.



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296255
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Outputting a hash character in an IIF() function.

2008-01-09 Thread Ian Skinner
Dave wrote:
 Have you tried assigning it to a variable in a cfset and then displaying the
 variable.  Alternately, convert to RGB:  style=background-color:rgb(221 255
 221)'
Yes I can set and use a variable, but I was curious why I would have to 
do this.  Why do I need to create five lines to set a variable and use a 
few bits more memory rather then use one clear function at the point 
where the decision needs to be made.

The RGB solution is a good one.  But I am still curious why one can not 
apparently output a hash mark in this manner.

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296256
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Outputting a hash character in an IIF() function.

2008-01-09 Thread Tom Chiverton
On Wednesday 09 Jan 2008, Ian Skinner wrote:
 Generally because I prefer to KNOW why I have to replace one clear line
 of code with 5 lines of slightly less clear code that requires the using
 a few bits more memory to store a variable I will not use any place else.

if (foo){
bar=a
}else{
bar=b
}
b

seems clearer to me than nested iif and de.

-- 
Tom Chiverton
Helping to revolutionarily orchestrate B2B experiences
on: http://thefalken.livejournal.com



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at 
Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list 
of members is available for inspection at the registered office. Any reference 
to a partner in relation to Halliwells LLP means a member of Halliwells LLP.  
Regulated by The Solicitors Regulation Authority.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 2500.

For more information about Halliwells LLP visit www.halliwells.com.

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296257
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Outputting a hash character in an IIF() function.

2008-01-09 Thread Brad Wood
The hash simply needs to be escaped as 
#iif(bgFlag,DE(' style=background-color: DDFFDD'),DE(''))#

The hash needs to be escaped twice since you are delaying evaluation.  

The text:
 style=background-color: DDFFDD

Is passed out of the de function as (including the quotes):
 style=background-color: ##DDFFDD

That text is then evaluated by the iif to:
style=background-color: #DDFFDD

~Brad

-Original Message-
From: Ian Skinner [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 09, 2008 10:14 AM
To: CF-Talk
Subject: Re: Outputting a hash character in an IIF() function.

Dave wrote:
 Have you tried assigning it to a variable in a cfset and then
displaying the
 variable.  Alternately, convert to RGB:
style=background-color:rgb(221 255
 221)'
Yes I can set and use a variable, but I was curious why I would have to 
do this.  Why do I need to create five lines to set a variable and use a

few bits more memory rather then use one clear function at the point 
where the decision needs to be made.

The RGB solution is a good one.  But I am still curious why one can not 
apparently output a hash mark in this manner.



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296258
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Outputting a hash character in an IIF() function.

2008-01-09 Thread Brad Wood
Actually, if I am going to use braces, I like them to align vertically
for better readability:

if (foo)
{
bar = a;
}
else
{
bar = b;
}

But enough of this.  He didn't ask for our opinions in code readability,
he asked how to escape a hash mark in an iif.  (which I answered in my
previous reply.

~Brad

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296259
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Outputting a hash character in an IIF() function.

2008-01-09 Thread Ian Skinner
Brad Wood wrote:
 The hash simply needs to be escaped as 
 #iif(bgFlag,DE(' style=background-color: DDFFDD'),DE(''))#

 The hash needs to be escaped twice since you are delaying evaluation.  

 The text:
  style=background-color: DDFFDD

 Is passed out of the de function as (including the quotes):
  style=background-color: ##DDFFDD

 That text is then evaluated by the iif to:
 style=background-color: #DDFFDD

 ~Brad
Thanks, now I understand what is going on.  I had tried three, but never 
took it to four.



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296260
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Outputting a hash character in an IIF() function.

2008-01-09 Thread Ian Skinner
Tom Chiverton wrote:
 if (foo){
   bar=a
 }else{
   bar=b
 }
 b

 seems clearer to me than nested iif and de.
This is completely personal preference and a very very small matter.  
But I generally find less to be clearer then more.

--
cfscript
  if (foo) {
bar='a';
} else {
bar='b';
}
/cfscript

use_number #bar#
-
7 lines

VERSUS

-
use_number #iif(foo,DE('a'),DE('b'))#
-
1 line.

But each to his own.  I still wanted to know WHY it was not working and 
now I do.


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296262
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Outputting a hash character in an IIF() function.

2008-01-09 Thread Bobby Hartsfield
cfscriptif (foo) {bar='a';} else {bar='b';}/cfscriptuse_number #bar#

Now it's one line... who didn't see that coming? :-P


..:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com





~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296272
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Iif and CF 7vs. CF 8

2007-11-06 Thread Lincoln Milner
Hello, all,

I have this code snippet below which runs fine on my local workstation
(Windows XP, CF 8 IIS 5.1).  When I throw it up on our dev server
(Windows 2k3, IIS 6, CF 7) I get an index out of bounds error on the
second IIF line below.  I've looked at the docs and I don't see why
this code should not work on 7 but work fine on 8.  Anyone have any
ideas, or are you all just going to tell me to not use IIF?

Thanks!
Lincoln

cfloop from=1 to=#ListLen(form.txtFileName)# index=intCounter

cfset uploadFile(
IIF(Len(Trim(form.txtFileName)) GT 0,
Evaluate(DE(ListGetAt(form.txtFileName, intCounter))), ),
IIF((Len(Trim(form.txtFileDesc)) GT 0),
Evaluate(DE(ListGetAt(form.txtFileDesc, intCounter))), ),
form.hidCategory,
IIF((Len(Trim(form.txtEffDate)) GT 0),
Evaluate(DE(ListGetAt(form.txtEffDate, intCounter))), ),
form.hidId,
intCounter)

/cfloop

~|
Get involved in the latest ColdFusion discussions, product
development sharing, and articles on the Adobe Labs wiki.
http://labs/adobe.com/wiki/index.php/ColdFusion_8

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292729
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Iif and CF 7vs. CF 8

2007-11-06 Thread Dave Watts
 cfset uploadFile(
 IIF(Len(Trim(form.txtFileName)) GT 0,
 Evaluate(DE(ListGetAt(form.txtFileName, 
 intCounter))), ), ...

Why are you using DE inside Evaluate? The point of the DE (Delay Evaluation) 
function is to prevent the automatic evaluation that occurs within IIF.

Dave Watts, CTO, Fig Leaf Software


~|
ColdFusion 8 - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292733
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Just a tidbit for those who might not have use iif before

2007-03-23 Thread Richard Cooper
I'm assuming there is a noticeable difference in using IFF? Recently I've been 
using it quite heavily in forms now i.e. 

cfinput type=radio name=myField id=myField value=myValue 
checked=#IIF(something eq 'somethingelse', DE('Yes'), DE('No'))# /

Are there better ways of doing this?

~|
ColdFusion MX7 by Adobe®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. 
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273488
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Just a tidbit for those who might not have use iif before

2007-03-23 Thread Rob Wilkerson
checked=#something eq 'somethingelse#

That should work just fine.  No need for the iff() in this case.

On 3/23/07, Richard Cooper [EMAIL PROTECTED] wrote:

 I'm assuming there is a noticeable difference in using IFF? Recently I've
 been using it quite heavily in forms now i.e.

 cfinput type=radio name=myField id=myField value=myValue
 checked=#IIF(something eq 'somethingelse', DE('Yes'), DE('No'))# /

 Are there better ways of doing this?

 

~|
Create Web Applications With ColdFusion MX7  Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273495
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Just a tidbit for those who might not have use iif before

2007-03-23 Thread Peter Boughton
First better way: Don't use strings for booleans!
cfinput type=radio name=myField id=myField value=myValue 
checked=#IIF(something eq 'somethingelse', 1, 0)# /

Second better way: Don't write if True then True else False!
cfinput type=radio name=myField id=myField value=myValue 
checked=#(something eq 'somethingelse')# /
(parenthesis are unnecessary here, but I feel they make it more readable)

Third better way: Don't use cfform!
form:select id=myField options=myValue value=somethingelse/
(that's from my form custom tag library, not yet released)


:)


 I'm assuming there is a noticeable difference in using IFF? Recently 
 I've been using it quite heavily in forms now i.e. 
 
 cfinput type=radio name=myField id=myField value=myValue 
 checked=#IIF(something eq 'somethingelse', DE('Yes'), DE('No'))# /
 
 Are there better ways of doing this?

~|
ColdFusion MX7 and Flex 2 
Build sales  marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273508
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Just a tidbit for those who might not have use iif before

2007-03-22 Thread Peterson, Chris
I have never really used iif before, I was aware it existed but didn't
really see a good place for it.  Until today. =)

Check this out:

dollarformat(iif(Cost, cost, 0))

That says, evaluate cost as a Boolean, if its true (anything but 0 or
null) then return cost, otherwise return 0 (so the dollarFormat does not
break)  This is great instead of a cfif around the whole thing.

Kinda cool =)

Chris

~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7  
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273435
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Just a tidbit for those who might not have use iif before

2007-03-22 Thread Rob Wilkerson
Uh oh.  You're probably about to get hammered with responses related to the
performance cost...

On 3/22/07, Peterson, Chris [EMAIL PROTECTED] wrote:

 I have never really used iif before, I was aware it existed but didn't
 really see a good place for it.  Until today. =)

 Check this out:

 dollarformat(iif(Cost, cost, 0))

 That says, evaluate cost as a Boolean, if its true (anything but 0 or
 null) then return cost, otherwise return 0 (so the dollarFormat does not
 break)  This is great instead of a cfif around the whole thing.

 Kinda cool =)

 Chris

 

~|
ColdFusion MX7 and Flex 2 
Build sales  marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273436
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Just a tidbit for those who might not have use iif before

2007-03-22 Thread Andy Matthews
Here come the Iif police. 

-Original Message-
From: Peterson, Chris [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 22, 2007 3:10 PM
To: CF-Talk
Subject: Just a tidbit for those who might not have use iif before

I have never really used iif before, I was aware it existed but didn't
really see a good place for it.  Until today. =)

Check this out:

dollarformat(iif(Cost, cost, 0))

That says, evaluate cost as a Boolean, if its true (anything but 0 or
null) then return cost, otherwise return 0 (so the dollarFormat does not
break)  This is great instead of a cfif around the whole thing.

Kinda cool =)

Chris



~|
Create Web Applications With ColdFusion MX7  Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273437
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Just a tidbit for those who might not have use iif before

2007-03-22 Thread John Rossi
and about whether Cost is truly a Boolean...

-Original Message-
From: Rob Wilkerson [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 22, 2007 3:15 PM
To: CF-Talk
Subject: Re: Just a tidbit for those who might not have use iif before


Uh oh.  You're probably about to get hammered with responses related to the
performance cost...

On 3/22/07, Peterson, Chris [EMAIL PROTECTED] wrote:

 I have never really used iif before, I was aware it existed but didn't 
 really see a good place for it.  Until today. =)

 Check this out:

 dollarformat(iif(Cost, cost, 0))

 That says, evaluate cost as a Boolean, if its true (anything but 0 or
 null) then return cost, otherwise return 0 (so the dollarFormat does 
 not
 break)  This is great instead of a cfif around the whole thing.

 Kinda cool =)

 Chris

 



~|
Macromedia ColdFusion MX7
Upgrade to MX7  experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273438
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Just a tidbit for those who might not have use iif before

2007-03-22 Thread Heald, Timothy J
Quick, someone find a way to make that need an evaluate().

-Original Message-
From: Andy Matthews [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 22, 2007 4:17 PM
To: CF-Talk
Subject: RE: Just a tidbit for those who might not have use iif before

Here come the Iif police. 

-Original Message-
From: Peterson, Chris [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 22, 2007 3:10 PM
To: CF-Talk
Subject: Just a tidbit for those who might not have use iif before

I have never really used iif before, I was aware it existed but didn't
really see a good place for it.  Until today. =)

Check this out:

dollarformat(iif(Cost, cost, 0))

That says, evaluate cost as a Boolean, if its true (anything but 0 or
null) then return cost, otherwise return 0 (so the dollarFormat does not
break)  This is great instead of a cfif around the whole thing.

Kinda cool =)

Chris





~|
Create Web Applications With ColdFusion MX7  Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273439
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Just a tidbit for those who might not have use iif before

2007-03-22 Thread Justin Scott
 dollarformat(iif(Cost, cost, 0))

You could also use the val() function around the cost variable to do the
same thing more efficiently.  It will also correct for unexpected
non-integer characters in the variable as well.  I've found that in
almost any situation where iif() looks like it's needed, there's a
better way.  There are exceptions, but I don't think this is one of
them.


-Justin Scott

~|
Create Web Applications With ColdFusion MX7  Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273442
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Just a tidbit for those who might not have use iif before

2007-03-22 Thread Rob Wilkerson
I think I heard something about them going back on tour this year...

On 3/22/07, Andy Matthews [EMAIL PROTECTED] wrote:
 Here come the Iif police.

 -Original Message-
 From: Peterson, Chris [mailto:[EMAIL PROTECTED]
 Sent: Thursday, March 22, 2007 3:10 PM
 To: CF-Talk
 Subject: Just a tidbit for those who might not have use iif before

 I have never really used iif before, I was aware it existed but didn't
 really see a good place for it.  Until today. =)

 Check this out:

 dollarformat(iif(Cost, cost, 0))

 That says, evaluate cost as a Boolean, if its true (anything but 0 or
 null) then return cost, otherwise return 0 (so the dollarFormat does not
 break)  This is great instead of a cfif around the whole thing.

 Kinda cool =)

 Chris



 

~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade  see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273463
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Using Iif and De together...

2006-12-07 Thread Andy Matthews
I KNOW that I've used this method successfully before, but for some reason
it's not working correctly now.

I've got a radio button in a form. I want to make sure that button is there,
and if so use it's value. It it's not there then I want the string N:

IIf(NOT
StructKeyExists(FORM,listing_openhouse),Trim(FORM.listing_openhouse),De(N
))

I'm using this so that I can put it on one line. It's more cosmetic than
necessary, but it should be working and I'm not sure why it isn't.

Anyone have any ideas?

!//--
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--//-


~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:263158
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Using Iif and De together...

2006-12-07 Thread JediHomer
IIf(StructKeyExists(FORM, listing_openhouse),
'Trim(FORM.listing_openhouse)', 'N')

*should* do it :)


On 07/12/06, Andy Matthews [EMAIL PROTECTED] wrote:
 I KNOW that I've used this method successfully before, but for some reason
 it's not working correctly now.

 I've got a radio button in a form. I want to make sure that button is there,
 and if so use it's value. It it's not there then I want the string N:

 IIf(NOT
 StructKeyExists(FORM,listing_openhouse),Trim(FORM.listing_openhouse),De(N
 ))

 I'm using this so that I can put it on one line. It's more cosmetic than
 necessary, but it should be working and I'm not sure why it isn't.

 Anyone have any ideas?

 !//--
 andy matthews
 web developer
 certified advanced coldfusion programmer
 ICGLink, Inc.
 [EMAIL PROTECTED]
 615.370.1530 x737
 --//-


 

~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:263161
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Using Iif and De together...

2006-12-07 Thread Michael Dinowitz
Two points. The first is that any variable or function used in the last 2 
arguments will be evaluated both before and after the tag runs and DE is used 
only to quote a variable/function rather than forcing the programmer to do it 
themselves.
That being said, the problem is probably in your second argument. Before the 
function is processed, the trim function will run and the 
Trim(FORM.listing_openhouse) will be replaced with text. If this is 'true' then 
the result of the trim will be treated as a variable, not as a value. I'd 
rewrite the function as:
IIf(NOT StructKeyExists(FORM, 'listing_openhouse'), 
'Trim(FORM.listing_openhouse)', 'N')

The second argument is escaped and will only be evaluated if it is 'true'. The 
third argument is double escaped which is exactly what De would do for you.
This should work for you.

I KNOW that I've used this method successfully before, but for some reason
it's not working correctly now.

I've got a radio button in a form. I want to make sure that button is there,
and if so use it's value. It it's not there then I want the string N:

IIf(NOT
StructKeyExists(FORM,listing_openhouse),Trim(FORM.listing_openhouse),De(N
))

I'm using this so that I can put it on one line. It's more cosmetic than
necessary, but it should be working and I'm not sure why it isn't.

Anyone have any ideas?

!//--
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--//-

~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:263162
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Using Iif and De together...

2006-12-07 Thread Andy Matthews
I think that's what I was missing guys. The extra set of quotes on the final
argument.

Thanks Michael and jedihomer

!//--
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--//-

-Original Message-
From: Michael Dinowitz [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 07, 2006 9:48 AM
To: CF-Talk
Subject: Re: Using Iif and De together...


Two points. The first is that any variable or function used in the last 2
arguments will be evaluated both before and after the tag runs and DE is
used only to quote a variable/function rather than forcing the programmer to
do it themselves.
That being said, the problem is probably in your second argument. Before the
function is processed, the trim function will run and the
Trim(FORM.listing_openhouse) will be replaced with text. If this is 'true'
then the result of the trim will be treated as a variable, not as a value.
I'd rewrite the function as:
IIf(NOT StructKeyExists(FORM, 'listing_openhouse'),
'Trim(FORM.listing_openhouse)', 'N')

The second argument is escaped and will only be evaluated if it is 'true'.
The third argument is double escaped which is exactly what De would do for
you.
This should work for you.

I KNOW that I've used this method successfully before, but for some reason
it's not working correctly now.

I've got a radio button in a form. I want to make sure that button is
there,
and if so use it's value. It it's not there then I want the string N:

IIf(NOT
StructKeyExists(FORM,listing_openhouse),Trim(FORM.listing_openhouse),De(
N
))

I'm using this so that I can put it on one line. It's more cosmetic than
necessary, but it should be working and I'm not sure why it isn't.

Anyone have any ideas?

!//--
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--//-



~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:263164
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Using Iif and De together...

2006-12-07 Thread Bobby Hartsfield
Couldn’t you just use:

cfparam name=form.listing_openhouse default=N /

If it already exists, its value will be in form.listing_openhouse
If it DOES not exist, it will be created and the value N will be stored in
it.

..:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
 

 


-Original Message-
From: Andy Matthews [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 07, 2006 11:49 AM
To: CF-Talk
Subject: Using Iif and De together...

I KNOW that I've used this method successfully before, but for some reason
it's not working correctly now.

I've got a radio button in a form. I want to make sure that button is there,
and if so use it's value. It it's not there then I want the string N:

IIf(NOT
StructKeyExists(FORM,listing_openhouse),Trim(FORM.listing_openhouse),De(N
))

I'm using this so that I can put it on one line. It's more cosmetic than
necessary, but it should be working and I'm not sure why it isn't.

Anyone have any ideas?

!//--
andy matthews
web developer
certified advanced coldfusion programmer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--//-




~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:263217
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: iif: am I understanding correctly?

2006-07-24 Thread Snake
This always makes me laugh.

Why don't you make a page with CFIF, then run it

Now use IIF() and run it

What difference do you see in execution time? Bugger all.

If you make a big loop that calls IIF 1000 times then you may notice a
difference.

Also imagine this code

select name = bob #IIF(name is bob, 'selected','')#

Now do the same thing with CFIF/CFELSE, how messy is that.

Don't NOT use something just because some cycle counting freak tells you not
to because you must save every possible 1000th of a millisecond. At least
try it for yourself first.

-
Snake


-Original Message-
From: Mike Soultanian [mailto:[EMAIL PROTECTED] 
Sent: 24 July 2006 04:17
To: CF-Talk
Subject: Re: iif: am I understanding correctly?



Don't use iif()

Always use cfif/cfelse instead of iif(). It is significantly faster and more
readable.

Mike




~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:247467
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: iif: am I understanding correctly?

2006-07-24 Thread Ashwin Mathew
I've seen debates around this so many times I decided to blog it:
http://blogs.sanmathi.org/ashwin/2006/07/24/whento-evaluate-and-iif/

In summary - evaluate() and iif() will perform well when the expressions
being evaluated remain static, since the Java classes that are compiled
to process the expressions are cached in memory. If the expressions
change from call to call (different sets of operators and variables),
then these will be expensive, since the expressions will have to be
compiled into Java classes for every call. 

-Original Message-
From: Snake [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 24, 2006 2:18 PM
To: CF-Talk
Subject: RE: iif: am I understanding correctly?

This always makes me laugh.

Why don't you make a page with CFIF, then run it

Now use IIF() and run it

What difference do you see in execution time? Bugger all.

If you make a big loop that calls IIF 1000 times then you may notice a
difference.

Also imagine this code

select name = bob #IIF(name is bob, 'selected','')#

Now do the same thing with CFIF/CFELSE, how messy is that.

Don't NOT use something just because some cycle counting freak tells you
not to because you must save every possible 1000th of a millisecond. At
least try it for yourself first.

-
Snake


-Original Message-
From: Mike Soultanian [mailto:[EMAIL PROTECTED]
Sent: 24 July 2006 04:17
To: CF-Talk
Subject: Re: iif: am I understanding correctly?



Don't use iif()

Always use cfif/cfelse instead of iif(). It is significantly faster and
more
readable.

Mike






~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:247476
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: iif: am I understanding correctly?

2006-07-24 Thread Russ
Well we all know what the industry standard has been, but it seems that in
real world tests, iif is faster then cfif in some instances, and arguably
more readable (especially if you're using it inside a select or
radio/checkbox.  

Russ

 -Original Message-
 From: Mike Soultanian [mailto:[EMAIL PROTECTED]
 Sent: Sunday, July 23, 2006 11:17 PM
 To: CF-Talk
 Subject: Re: iif: am I understanding correctly?
 
 I saw this written in the Coldfusion coding practices from Sean Corfield:
 
 http://livedocs.macromedia.com/wtg/public/coding_standards/performance.htm
 l
 
 Performance Don'ts
 
 The following are 'negative' recommendations, e.g., Don't do xyz
 
 Don't use evaluate()
 
 Avoid evaluate() unless there is no other way to write your code (and
 there is almost always another way to write your code).
 
 Don't use iif()
 
 Always use cfif/cfelse instead of iif(). It is significantly faster and
 more readable.
 
 Mike
 
 Russ wrote:
  I wrote some test code, and it seems that cfif and iif perform
 similarly,
  and sometimes cfif ends up being slower?  Is my test code flawed in some
  way?
 
  cfset startTime=GetTickCount()
  cfloop from=1 to=10 index=x
  cfoutput#iif(isDefined(blah),DE(.),DE(,))#/cfoutput
  /cfloop
  cfset midTime=GetTickCount()
 
  cfloop from=1 to=10 index=x
  cfoutput
  cfif isDefined(blah)
  .
  cfelse
  ,
  /cfif
  /cfoutput
  /cfloop
  cfset endTime=getTickCount()
  cfoutputbrThe time to do with IIF is #midtime-starttime#/cfoutput
  cfoutputbrTime to do with cfif #endTime-midTime#/cfoutput
 
  Russ
 
  -Original Message-
  From: Munson, Jacob [mailto:[EMAIL PROTECTED]
  Sent: Friday, July 21, 2006 6:34 PM
  To: CF-Talk
  Subject: RE: iif: am I understanding correctly?
 
  This part of the app is not going to take heavy traffic, so
  the performance
  hit would be negligible.  However going forward I will always
  take into
  consideration the possible performance implications of
  iif/evaluate/DE.
  Yeah, and another thing to keep in mind when memorizing things that
  perform better performance can change with new versions of CF.  Or if
  you move to a different app server, or different OS.  That's why I said
  I like to test my own code, if I'm worried, because I never believe the
  'general rules of thumb'.  :)
 
 
  ---
 
  This transmission may contain information that is privileged,
 confidential
  and/or exempt from disclosure under applicable law. If you are not the
  intended recipient, you are hereby notified that any disclosure,
 copying,
  distribution, or use of the information contained herein (including any
  reliance thereon) is STRICTLY PROHIBITED. If you received this
  transmission in error, please immediately contact the sender and
 destroy
  the material in its entirety, whether in electronic or hard copy
 format.
  Thank you. A1.
 
 
 
 
 
 
 
 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:247503
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: iif: am I understanding correctly?

2006-07-23 Thread Russ
Looks like that works... and for large values of X, looks like this method
is the fastest, followed by iif with DE, followed by cfif.  Does this mean
that it's no longer true that iif is not efficient?  If I'm using it only a
few times on a page, and it's a little slower then cfif, I don't really
care, and if it's faster then cfif when I use it inside something that does
a lot of computation, I might as well... More likely I will be using
whichever statement make sense, iif inside checkboxes and select's and such
and cfif elsewhere, since they are about the same.  

Russ

 -Original Message-
 From: Phillip Holmes [mailto:[EMAIL PROTECTED]
 Sent: Sunday, July 23, 2006 2:26 AM
 To: CF-Talk
 Subject: RE: iif: am I understanding correctly?
 
 You must have copied the code straight off the page. The ticks that my
 blog
 displays are blowing up CF.
 Try this.
 
 cfscript
   variables.foo = 1;
   out = IIf(variables.foo NEQ 1,'aString1','aString2');
   writeOutput(out);
 /cfscript
 
 
 Warmest Regards,
 
 Phillip B. Holmes
 http://phillipholmes.com
 214-995-6175 (cell)
 
 
 
 
 
 
 -Original Message-
 From: Russ [mailto:[EMAIL PROTECTED]
 Sent: Sunday, July 23, 2006 1:11 AM
 To: CF-Talk
 Subject: RE: iif: am I understanding correctly?
 
 I'm not too sure what you're trying to do in that article, but I couldn't
 get it to compile... can you explain what you're doing?
 
 Russ
 
  -Original Message-
  From: Phillip Holmes [mailto:[EMAIL PROTECTED]
  Sent: Sunday, July 23, 2006 1:59 AM
  To: CF-Talk
  Subject: RE: iif: am I understanding correctly?
 
  Brad,
 
  IIF() actually compiles down to a 'short-circuited' if in java.
 
  Here is an article about how to use IIF() without having to use
  evaluate()
  -
  IIf() without Delayed Evaluation.
 
  http://www.phillipholmes.com/?p=43
 
  Warmest Regards,
 
  Phillip B. Holmes
  http://phillipholmes.com
  214-995-6175 (cell)
 
 
 
 
 
 
  -Original Message-
  From: Brad Wood [mailto:[EMAIL PROTECTED]
  Sent: Sunday, July 23, 2006 12:40 AM
  To: CF-Talk
  Subject: RE: iif: am I understanding correctly?
 
  Hmm, I had always just figured that cfif and iif just compiled down to
  the exact same java anyway...
 
  I wonder if one could have an advantage over the other if the
  condition was either true or false  all this worrying over a few
  microseconds
  :)
 
  ~Brad
 
  --
  No virus found in this outgoing message.
  Checked by AVG Free Edition.
  Version: 7.1.394 / Virus Database: 268.10.1/390 - Release Date:
  7/17/2006
 
 
 
 
 
 
 
 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:247433
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


iif: am I understanding correctly?

2006-07-21 Thread Josh Nathanson
I have some code that loops over a list of fields to cfparam some 
attributes.  The idea is, if the query (getCust) returns a record, set the 
attribute to the query.column value;  if no record, set the attribute to 
null.  After some hacking around I got it to work as desired, but I don't 
quite understand how.

cfset fieldlist = 
Customer_ID,FirstName,LastName,Email,Address1,Address2,City,State,State2,Zip,Country,Phone
cfloop list=#fieldlist# index=i
 cfset temp = iif(didquery and didfind, getCust.#i#, DE())
 cfparam name=attributes.#i# default=#temp#
/cfloop

What I don't get is how iif works.  It seems to do the following:
- Doesn't evaluate getCust.#i# when the page is compiled
- Assuming the iif conditional evaluates true, when the list is looped, 
first evaluates just the #i# in getCust.#i# to return the proper field 
name, then evaluates the variable getCust.FirstName (for example) to 
return the correct value.  So there is sort of a double evaluation going on.

Am I understanding iif correctly or does someone have a better explanation 
as to how it works.  The docs are kind of hard to fathom.

-- Josh



~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:247345
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: iif: am I understanding correctly?

2006-07-21 Thread Munson, Jacob
Does it?  I'm assuming you're referring to dynamic variables (from
reading your other reply), but my cfif example has a dynamic variable as
well. 

 -Original Message-
 From: loathe [mailto:[EMAIL PROTECTED] 
 Sent: Friday, July 21, 2006 2:37 PM
 
 But it executes much faster.
 
  -Original Message-
  From: Munson, Jacob [mailto:[EMAIL PROTECTED]
  Sent: Friday, July 21, 2006 4:22 PM
  
  Here's how I understand iif:  If the condition is true, 
 return the 2nd
  parameter, otherwise return the 3rd.
  
  So in your example, if (didquery and didfind) returns true, the code
  will evaluate getCust.#i#.  Otherwise it will evaluate DE().
  
  iif is basically just a shorter cfif statement, using your 
 example iif,
  this would do the same thing:
  cfif didquery and didfind
  cfset temp = evaluate(getCust.#i#)
  cfelse
  cfset temp = 
  /cfif
  
  But that takes a lot more code.

This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, 
or use of the information contained herein (including any reliance thereon) is 
STRICTLY PROHIBITED. If you received this transmission in error, please 
immediately contact the sender and destroy the material in its entirety, 
whether in electronic or hard copy format. Thank you. A1.



~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:247360
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: iif: am I understanding correctly?

2006-07-21 Thread loathe
cfif didquery and didfind
cfset temp = variables[getCust][i]
cfelse
cfset temp = 
/cfif

Does the same thing right?

 -Original Message-
 From: Munson, Jacob [mailto:[EMAIL PROTECTED]
 Sent: Friday, July 21, 2006 4:43 PM
 To: CF-Talk
 Subject: RE: iif: am I understanding correctly?
 
 Does it?  I'm assuming you're referring to dynamic variables (from
 reading your other reply), but my cfif example has a dynamic variable as
 well.
 
  -Original Message-
  From: loathe [mailto:[EMAIL PROTECTED]
  Sent: Friday, July 21, 2006 2:37 PM
 
  But it executes much faster.
 
   -Original Message-
   From: Munson, Jacob [mailto:[EMAIL PROTECTED]
   Sent: Friday, July 21, 2006 4:22 PM
  
   Here's how I understand iif:  If the condition is true,
  return the 2nd
   parameter, otherwise return the 3rd.
  
   So in your example, if (didquery and didfind) returns true, the code
   will evaluate getCust.#i#.  Otherwise it will evaluate DE().
  
   iif is basically just a shorter cfif statement, using your
  example iif,
   this would do the same thing:
  
   But that takes a lot more code.
 
 This transmission may contain information that is privileged, confidential
 and/or exempt from disclosure under applicable law. If you are not the
 intended recipient, you are hereby notified that any disclosure, copying,
 distribution, or use of the information contained herein (including any
 reliance thereon) is STRICTLY PROHIBITED. If you received this
 transmission in error, please immediately contact the sender and destroy
 the material in its entirety, whether in electronic or hard copy format.
 Thank you. A1.
 
 
 
 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:247365
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: iif: am I understanding correctly?

2006-07-21 Thread Munson, Jacob
Yeah, it should.  But the question is, is that faster or not?  Without
running some tests with cftimer, I'm not sure.  But I'm always a fan of
using less code, as long as it doesn't kill the server.  :)

 -Original Message-
 From: loathe [mailto:[EMAIL PROTECTED] 
 Sent: Friday, July 21, 2006 3:00 PM
 
 cfif didquery and didfind
   cfset temp = variables[getCust][i]
 cfelse
   cfset temp = 
 /cfif
 
 Does the same thing right?
 
  -Original Message-
  From: Munson, Jacob [mailto:[EMAIL PROTECTED]
  Sent: Friday, July 21, 2006 4:43 PM
  To: CF-Talk
  Subject: RE: iif: am I understanding correctly?
  
  Does it?  I'm assuming you're referring to dynamic variables (from
  reading your other reply), but my cfif example has a 
 dynamic variable as
  well.
  
   -Original Message-
   From: loathe [mailto:[EMAIL PROTECTED]
   Sent: Friday, July 21, 2006 2:37 PM
  
   But it executes much faster.

This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, 
or use of the information contained herein (including any reliance thereon) is 
STRICTLY PROHIBITED. If you received this transmission in error, please 
immediately contact the sender and destroy the material in its entirety, 
whether in electronic or hard copy format. Thank you. A1.



~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:247369
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: iif: am I understanding correctly?

2006-07-21 Thread Josh Nathanson
This part of the app is not going to take heavy traffic, so the performance 
hit would be negligible.  However going forward I will always take into 
consideration the possible performance implications of iif/evaluate/DE.

Ben -- I guess I like messing around with stuff like this (iif, evaluate 
etc.) because I feel like I don't fully understand it, and if I can get it 
to work as desired, maybe I can come to a better understanding of how 
certain things in CF work in a more general sense.

-- Josh


- Original Message - 
From: Munson, Jacob [EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Sent: Friday, July 21, 2006 2:52 PM
Subject: RE: iif: am I understanding correctly?


 OK, I ran cftimer on both examples, iif and the if/else way,
 and both came
 back 0 ms.  So I think in this case, since it's only looping
 over 10 list
 items or whatever, I'll stick with the leaner code.  Maybe if
 you were
 looping over thousands of list elements or query rows or
 something, there'd
 be a more noticeable performance hit.

 Interesting.  However, if your app ever need's to scale, it /could/ end
 up being thousands of list elements, if hundreds of people are firing
 that code simultaneously.  That's why I usually try to simulate some
 traffic by putting the pieces of code I want to test in a loop that runs
 thousands of times.  It's not the best way to test (a load tester would
 be better), but it gives you a better idea.  Of course, none of this is
 relevant if you know your app will never have that much traffic.  :)


 -

 This transmission may contain information that is privileged, confidential 
 and/or exempt from disclosure under applicable law. If you are not the 
 intended recipient, you are hereby notified that any disclosure, copying, 
 distribution, or use of the information contained herein (including any 
 reliance thereon) is STRICTLY PROHIBITED. If you received this 
 transmission in error, please immediately contact the sender and destroy 
 the material in its entirety, whether in electronic or hard copy format. 
 Thank you. A1.



 

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:247390
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: iif: am I understanding correctly?

2006-07-21 Thread Ben Nadel
Josh, 

I am right with you on that point! I am a huge fan of learning by doing!
Keep it up.

...
Ben Nadel 
www.bennadel.com

-Original Message-
From: Josh Nathanson [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 21, 2006 6:10 PM
To: CF-Talk
Subject: Re: iif: am I understanding correctly?

This part of the app is not going to take heavy traffic, so the performance
hit would be negligible.  However going forward I will always take into
consideration the possible performance implications of iif/evaluate/DE.

Ben -- I guess I like messing around with stuff like this (iif, evaluate
etc.) because I feel like I don't fully understand it, and if I can get it
to work as desired, maybe I can come to a better understanding of how
certain things in CF work in a more general sense.

-- Josh


- Original Message -
From: Munson, Jacob [EMAIL PROTECTED]
To: CF-Talk cf-talk@houseoffusion.com
Sent: Friday, July 21, 2006 2:52 PM
Subject: RE: iif: am I understanding correctly?


 OK, I ran cftimer on both examples, iif and the if/else way,
 and both came
 back 0 ms.  So I think in this case, since it's only looping
 over 10 list
 items or whatever, I'll stick with the leaner code.  Maybe if
 you were
 looping over thousands of list elements or query rows or
 something, there'd
 be a more noticeable performance hit.

 Interesting.  However, if your app ever need's to scale, it /could/ end
 up being thousands of list elements, if hundreds of people are firing
 that code simultaneously.  That's why I usually try to simulate some
 traffic by putting the pieces of code I want to test in a loop that runs
 thousands of times.  It's not the best way to test (a load tester would
 be better), but it gives you a better idea.  Of course, none of this is
 relevant if you know your app will never have that much traffic.  :)


 -

 This transmission may contain information that is privileged, confidential

 and/or exempt from disclosure under applicable law. If you are not the 
 intended recipient, you are hereby notified that any disclosure, copying, 
 distribution, or use of the information contained herein (including any 
 reliance thereon) is STRICTLY PROHIBITED. If you received this 
 transmission in error, please immediately contact the sender and destroy 
 the material in its entirety, whether in electronic or hard copy format. 
 Thank you. A1.



 



~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:247392
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: iif: am I understanding correctly?

2006-07-21 Thread Munson, Jacob
 This part of the app is not going to take heavy traffic, so 
 the performance
 hit would be negligible.  However going forward I will always 
 take into
 consideration the possible performance implications of 
 iif/evaluate/DE.

Yeah, and another thing to keep in mind when memorizing things that
perform better performance can change with new versions of CF.  Or if
you move to a different app server, or different OS.  That's why I said
I like to test my own code, if I'm worried, because I never believe the
'general rules of thumb'.  :)


---

This transmission may contain information that is privileged, confidential 
and/or exempt from disclosure under applicable law. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, 
or use of the information contained herein (including any reliance thereon) is 
STRICTLY PROHIBITED. If you received this transmission in error, please 
immediately contact the sender and destroy the material in its entirety, 
whether in electronic or hard copy format. Thank you. A1.



~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/cf_lists/message.cfm/forumid:4/messageid:247393
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Using IIf() in query value

2006-06-05 Thread Tom Chiverton
On Friday 02 June 2006 23:20, Jim McAtee wrote:
 cfquery datasource=#dsn#
 INSERT INTO cctransactions (
   name,
   response
   )
 VALUES (
   '#form.name#',
   '#IIf(StructKeyExists(authresponse, http_response),
 authresponse.http_response,
 DE())#'
   )
 /cfquery


VALUES (
  cfqueryparam value=#form.name#,
  cfif StructKeyExists(authresponse, http_response
cfqueryparam value=#authresponse.http_response#
cfelse

/cfif
  )

-- 
Tom Chiverton



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at St 
James's Court Brown Street Manchester M2 2JF.  A list of members is available 
for inspection at the registered office. Any reference to a partner in relation 
to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law 
Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.

We are pleased to announce that Halliwells LLP has been voted AIM Lawyer of the 
Year at the 2005 Growth Company Awards


~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:242397
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Using IIf() in query value

2006-06-02 Thread Jim McAtee
I'm working in CF5. I thought single quotes within strings were always 
escaped in a cfquery.  I have a query using an IIf() in the value and this 
doesn't appear to be the case.  Does this have something to do with how 
I'm doing the evaluation of the second argument in the IIf() below?

In this simplification of the query the single quote within the first 
string is escaped, but the second one is not, causing an error.

form.name = John O'Mara
authresponse.http_response = 1|1|1|John O'Mara|approved

cfquery datasource=#dsn#
INSERT INTO cctransactions (
  name,
  response
  )
VALUES (
  '#form.name#',
  '#IIf(StructKeyExists(authresponse, http_response),
authresponse.http_response,
DE())#'
  )
/cfquery 


~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:242161
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: The IIf function

2006-05-02 Thread Everett, Al \(NIH/NIGMS\) [C]
It used to be, but is not so anymore, that IIF() was slower than
cfifcfelse/cfif.

It also used to be true, although I don't think it is any more, that all
of the expressions in an IIF() are evaluated even if not used. Not true
of cfif.

I know in older versions this would cause an error:

#iif(isDefined(myVar),myVar,'undefined'))#

However, this wouldn't:

cfif isDefined(myVar)
#myVar#
cfelse
undefined
/cfif

Yeah, I thought it was pretty goofy too.

I only ever really use iif() in situations like this:

select name=chosenOption
cfloop query=qOptions
option value=#qOptions.option_id#
#iif(qOptions.option_id eq
variables.default_option_id,'selected','')##qOptions.option_name#/
option
/cfloop
/select

I think it's very bad style to put CF tags inside HTML tags.



-Original Message-
From: Matthew Chambers [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 01, 2006 7:40 PM
To: CF-Talk
Subject: The IIf function

Hi all,

Am I correct in saying that the IIf function and the cfif tag work
differently on the following scenerio. In the CFIF tag, when the CFIF
fails it will jump over the code which follows until a CFELSEIF,
CFELSE or CFIF.
Here's an example:
--
CFIF
The cfif failed so this text is not run. More to the point this code is
not run, cfqueryKILL DATABASE/cfquery /CFIF
---
Where as with the IIf function, CF will still test that the code for
both the true and false cases will work? This is dumb, because the whole
point for an IF is to check that you will have everything you need to
run the code when it returns true.
:::CFIF eg:::
cfif IsDefined(foo
cfset foo = foo+1
/cfif
:::IIf eg:::
Iif(IsDefined(foo),DE(foo=foo+1),DE('whatever'))

Any thoughts?
Cheers




~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239234
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


The IIf function

2006-05-01 Thread Matthew Chambers
Hi all,

Am I correct in saying that the IIf function and the cfif tag work 
differently on the following scenerio. In the CFIF tag, when the CFIF fails it 
will jump over the code which follows until a CFELSEIF, CFELSE or CFIF.
Here's an example:
--
CFIF
The cfif failed so this text is not run. More to the point this code is not 
run, cfqueryKILL DATABASE/cfquery
/CFIF
---
Where as with the IIf function, CF will still test that the code for both the 
true and false cases will work? This is dumb, because the whole point for an IF 
is to check that you will have everything you need to run the code when it 
returns true.
:::CFIF eg:::
cfif IsDefined(foo
cfset foo = foo+1
/cfif
:::IIf eg:::
Iif(IsDefined(foo),DE(foo=foo+1),DE('whatever'))

Any thoughts?
Cheers


~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239205
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: The IIf function

2006-05-01 Thread Douglas Knudsen
IIF() is shorthand replacement for IF/THEN/ELSE.  Other langs have
IIF() too, eh?

Thus
cfif foo IS 5
   foo is 5
cfelse
   foo is not 5
/cfif

is equivalent to

IIF(foo IS 5, 'foo is 5', 'foo is not 5')

*note...mind the quotes!  ' is double quote followed by single quote

DK

On 5/1/06, Matthew Chambers [EMAIL PROTECTED] wrote:
 Hi all,

 Am I correct in saying that the IIf function and the cfif tag work 
 differently on the following scenerio. In the CFIF tag, when the CFIF fails 
 it will jump over the code which follows until a CFELSEIF, CFELSE or CFIF.
 Here's an example:
 --
 CFIF
 The cfif failed so this text is not run. More to the point this code is not 
 run, cfqueryKILL DATABASE/cfquery
 /CFIF
 ---
 Where as with the IIf function, CF will still test that the code for both the 
 true and false cases will work? This is dumb, because the whole point for an 
 IF is to check that you will have everything you need to run the code when it 
 returns true.
 :::CFIF eg:::
 cfif IsDefined(foo
 cfset foo = foo+1
 /cfif
 :::IIf eg:::
 Iif(IsDefined(foo),DE(foo=foo+1),DE('whatever'))

 Any thoughts?
 Cheers


 

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:239217
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: IIF help

2006-04-16 Thread Rick Root
Mingo Hagen wrote:
 
 no quotes in the first argument.

thanks everyone.. the quotes were the issue.

Rick

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237846
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


IIF help

2006-04-14 Thread Rick Root
I always have trouble using IIF...

Why doesn't this work?

cfset request.dirsep = iif(lcase(server.os.name) contains 
'windows',de(/),de(\))

It gives me this error:

Parameter validation error for function IIF.
The value of the parameter 1, which is currently lcase(server.os.name) 
contains 'windows', must be a boolean value.

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237739
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: IIF help

2006-04-14 Thread Everett, Al \(NIH/NIGMS\) [C]
Try this:

cfset request.dirsep =
iif(FindNoCase(windows,server.os.name),de(/),de(\)) 


Al Everett (Contractor)
DIGICON Corporation
National Institute of General Medical Science
Information Resources Management Branch
[EMAIL PROTECTED]
301.594.4082

-Original Message-
From: Rick Root [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 14, 2006 8:02 AM
To: CF-Talk
Subject: IIF help

I always have trouble using IIF...

Why doesn't this work?

cfset request.dirsep = iif(lcase(server.os.name) contains
'windows',de(/),de(\))

It gives me this error:

Parameter validation error for function IIF.
The value of the parameter 1, which is currently lcase(server.os.name)
contains 'windows', must be a boolean value.



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237740
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: IIF help

2006-04-14 Thread Douglas Knudsen
cfset request.dirsep = iif(lcase(server.os.name) contains
'windows','/','\')

try that, eh?

Also, no need for DE(), just use all teh quotes luke!   ' foo '  like that

DK

On 4/14/06, Rick Root [EMAIL PROTECTED] wrote:
 I always have trouble using IIF...

 Why doesn't this work?

 cfset request.dirsep = iif(lcase(server.os.name) contains
 'windows',de(/),de(\))

 It gives me this error:

 Parameter validation error for function IIF.
 The value of the parameter 1, which is currently lcase(server.os.name)
 contains 'windows', must be a boolean value.

 

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237741
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: IIF help

2006-04-14 Thread Mingo Hagen
iif(
lcase(server.os.name) contains 'windows',
de( \ ),
de( / )
)

no quotes in the first argument.



-- 
Met vriendelijke groet / Kind regards

Mingo J. Hagen.
E-Line Websolutions B.V.Herenweg 160
2101 MT  Heemstede

phone: +31620 775444
fax: +3123 5471920
fax [mingo]: +3184 7594914
e-mail / msn: [EMAIL PROTECTED]
skype: mjhagen
icq: 4775556
url: www.e-line.ws



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237742
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: IIF help

2006-04-14 Thread Andy Matthews
Rick...

It appears you've got quotes around your expression. Remove those and you
should be good.

!//--
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--//-

-Original Message-
From: Rick Root [mailto:[EMAIL PROTECTED]
Sent: Friday, April 14, 2006 7:02 AM
To: CF-Talk
Subject: IIF help


I always have trouble using IIF...

Why doesn't this work?

cfset request.dirsep = iif(lcase(server.os.name) contains
'windows',de(/),de(\))

It gives me this error:

Parameter validation error for function IIF.
The value of the parameter 1, which is currently lcase(server.os.name)
contains 'windows', must be a boolean value.



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237743
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


IIf() - Mix literal with variable evaluation

2006-01-09 Thread Jim McAtee
I always run into this, and I've probably come across a solution, but 
forgotten it.  In an IIf() I can easily return the value of a varible by 
surrounding it in quotes, or return a literal by using DE(), but how to 
use both?  What would be the correct syntax to use in the first argument 
to IIf() in the following example:

cfset a = loc.address  IIf(Len(loc.city), DE(, )  loc.city, DE()) 


~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228934
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: IIf() - Mix literal with variable evaluation

2006-01-09 Thread Zaphod Beeblebrox
cfset a = loc.address  IIf(Len(loc.city), DE(, #loc.city#) , DE())

On 1/9/06, Jim McAtee [EMAIL PROTECTED] wrote:
 I always run into this, and I've probably come across a solution, but
 forgotten it.  In an IIf() I can easily return the value of a varible by
 surrounding it in quotes, or return a literal by using DE(), but how to
 use both?  What would be the correct syntax to use in the first argument
 to IIf() in the following example:

 cfset a = loc.address  IIf(Len(loc.city), DE(, )  loc.city, DE())


 

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228948
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Syntax for IIF statement in report writer

2005-12-06 Thread Claremont, Timothy
I am using the CF report builder and having a tough time with a
conditional statement.

What I want to achieve is a field on the report that says either C or
FFS

What I want this to say is... If #query.capdate is before January 1,
1900, show FFS, otherwise show C

How do I make this work on the field in the report writer? I have tried
four billion things and keep getting an error saying that C is not a
valid variable name!

**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please delete it from 
your system.

This footnote also confirms that this email message has been swept for
the presence of computer viruses.

Thank You,
Viahealth
**


~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226246
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Syntax for IIF statement in report writer

2005-12-06 Thread Michael Dinowitz
Due to the double evaluation nature of IIF, you have to double escape text 
results in IIF. For example:
IIF(1 eq 1, 'one', 'not one')
What you see there is single quotes around double quotes. This can also be 
done with the DE() function, but that's a waste in my mind.

http://www.fusionauthority.com/Techniques/Article.cfm/ArticleID:2531


I am using the CF report builder and having a tough time with a
 conditional statement.

 What I want to achieve is a field on the report that says either C or
 FFS

 What I want this to say is... If #query.capdate is before January 1,
 1900, show FFS, otherwise show C

 How do I make this work on the field in the report writer? I have tried
 four billion things and keep getting an error saying that C is not a
 valid variable name!

 **
 This email and any files transmitted with it are confidential and
 intended solely for the use of the individual or entity to whom they
 are addressed. If you have received this email in error please delete it 
 from your system.

 This footnote also confirms that this email message has been swept for
 the presence of computer viruses.

 Thank You,
 Viahealth
 **


 

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226249
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


iif in MSSQL

2004-09-20 Thread Richard Meredith-Hardy
dear all

is there a way of doing the following in a query to MSSQL like you can
to access?

SELECT field1, field2, iif(field1 = field2,'same','different') AS mynote
FROM mytable 
WHERE etc

I appreciate it could be done in a SP or by analysing the output but in
this case it is easier not to... 

thanks

--
Regards;

Richard Meredith-Hardy
-
r[dot]mh[at]flymicro[dot]com
Tel: + 44 (0)1462 834776 FAX: + 44 (0)1462 732668
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: iif in MSSQL

2004-09-20 Thread Massimo Foti
 is there a way of doing the following in a query to MSSQL like you can
 to access?

 SELECT field1, field2, iif(field1 = field2,'same','different') AS mynote
 FROM mytable
 WHERE etc

 I appreciate it could be done in a SP or by analysing the output but in
 this case it is easier not to...

Check the docs for CASE.
The T-SQL equivalent should be something like:

SELECT field1, field2,
(CASE
 WHEN (field1 = field2)
 THEN 'same'
 ELSE 'different'
 END)
AS mynote
FROM mytable

Maybe it's not worth creating a dedicated SP, but you could still but it
inside a view and embed just a minum amount of SQL inside your CFML. You
would end up with something like:

SELECT *
FROM my View
WHERE etc


Massimo Foti
http://www.massimocorner.com

 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: iif in MSSQL

2004-09-20 Thread Jochem van Dieten
Richard Meredith-Hardy wrote:
 
 is there a way of doing the following in a query to MSSQL like you can
 to access?
 
 SELECT field1, field2, iif(field1 = field2,'same','different') AS mynote
 FROM mytable 
 WHERE etc

Look up the CASE .. WHEN .. THEN blabla statement. Maybe even 
Access understands this nowadays.

Jochem
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: iif in MSSQL

2004-09-20 Thread Qasim Rasheed
http://www.extremeexperts.com/sql/faq/IIForDecode.aspx

- Original Message -
From: Richard Meredith-Hardy [EMAIL PROTECTED]
Date: Mon, 20 Sep 2004 10:36:13 +0100
Subject: iif in MSSQL
To: CF-Talk [EMAIL PROTECTED]

dear all

is there a way of doing the following in a query to MSSQL like you can
to access?

SELECT field1, field2, iif(field1 = field2,'same','different') AS mynote
FROM mytable 
WHERE etc

I appreciate it could be done in a SP or by analysing the output but in
this case it is easier not to... 

thanks

--
Regards;

Richard Meredith-Hardy
-
r[dot]mh[at]flymicro[dot]com
Tel: + 44 (0)1462 834776 FAX: + 44 (0)1462
732668
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Re: iif in MSSQL

2004-09-20 Thread Richard Meredith-Hardy
Perfect.Thankyou!

--
Regards;

Richard Meredith-Hardy
-
r[dot]mh[at]flymicro[dot]com
Tel: + 44 (0)1462 834776 FAX: + 44 (0)1462 732668
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




Quickbooks IIF files???

2004-08-23 Thread Ray Champagne
I am currently building a timesheet application for my company, which is 
pretty simple.My boss wants me to save her some time by being able to 
take all the data that I am collecting from the employees and import it 
into Quickbooks.I have been google-ing this for the past hour, and what I 
am finding is that Quickbooks needs the import data to be in the Inuit Info 
File (I think that is what it stands for), or .iif format.Research on an 
iif file seems to show that it is just another version of a csv file.Has 
anyone in here ever exported from a db to Quickbooks before?I know how to 
create a csv file, but i just want to make sure that I am headed down the 
right path...

Back to my googling (and not out the window at the hotties walking by 
either, though that IS more fun...)

Thanks!

Ray

=
Ray Champagne - Senior Application Developer
CrystalVision Web Site Design and Internet Services
603.433.9559
www.crystalvision.org
=

The information contained in this transmission (including any attached
files) is CONFIDENTIAL and is intended only for the person(s) named
above. If you received this transmission in error, please delete it
from your system and notify us immediately. If you are not an intended
recipient, please note that any use or dissemination of the information
contained in this transmission (including any attached files) and the
copying, printing, or retransmission of that information is strictly
prohibited. You can notify us by return email or by phone at 603.433.9559.
Thank you.
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RE: Quickbooks IIF files???

2004-08-23 Thread Mark Leder
Ray,
Would something like this be of use? Take a look at the shopping cart
assistant, may work on the same principle as what you're after. 

 
http://www.writeitonce.com/

 
Mark

_

From: Ray Champagne [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 23, 2004 12:52 PM
To: CF-Talk
Subject: Quickbooks IIF files???

I am currently building a timesheet application for my company, which is 
pretty simple.My boss wants me to save her some time by being able to 
take all the data that I am collecting from the employees and import it 
into Quickbooks.I have been google-ing this for the past hour, and what I 
am finding is that Quickbooks needs the import data to be in the Inuit Info 
File (I think that is what it stands for), or .iif format.Research on an 
iif file seems to show that it is just another version of a csv file.Has 
anyone in here ever exported from a db to Quickbooks before?I know how to 
create a csv file, but i just want to make sure that I am headed down the 
right path...

Back to my googling (and not out the window at the hotties walking by 
either, though that IS more fun...)

Thanks!

Ray

=
Ray Champagne - Senior Application Developer
CrystalVision Web Site Design and Internet Services
603.433.9559
www.crystalvision.org
=

The information contained in this transmission (including any attached
files) is CONFIDENTIAL and is intended only for the person(s) named
above. If you received this transmission in error, please delete it
from your system and notify us immediately. If you are not an intended
recipient, please note that any use or dissemination of the information
contained in this transmission (including any attached files) and the
copying, printing, or retransmission of that information is strictly
prohibited. You can notify us by return email or by phone at 603.433.9559.
Thank you. 
_
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RE: Quickbooks IIF files???

2004-08-23 Thread Mark A. Kruger - CFG
You are correct - the iif file is pretty much a comma delimited ascii file. The
answer you need is actually in the quickbooks help files - here's an excerpt.

-Mark

---

You may also want to refer to the Reference Guide to Import Files

Note: These instructions are rather long. You may want to print them instead of
reading them onscreen. To print them, click Options and then choose Print Topic.

If you've been using another financial software product, and you'd like to
import information from that product into QuickBooks, you can do so if the
product allows you to export to a spreadsheet or text file. You can import lists
that correspond to QuickBooks lists, budgets, and individual transactions.

Tip: The easiest way to see and understand the format QuickBooks needs to import
data is to export some of your QuickBooks lists and view the resulting file in a
spreadsheet. If you don't already have a QuickBooks company, you can export
lists from the sample data (sample_product-based business. Qbw or
sample_service-based business.qbw).

1 Open the spreadsheet that contains the data.
2 Move the contents of all the cells in your spreadsheet one column to the right
so that the first column is blank.
3 Move the contents of all the cells down by one row so that the first row is
blank.
4 Check the structure of the spreadsheet. If it contains more than one type of
listor a mixture of lists, budgets, and transactionsmake sure that each type of
information has its own block in the spreadsheet. The blocks should follow each
other vertically. Insert a blank row of cells to separate the blocks.

For example, it you have a list of customers and a list of vendors, all the
customer data should be in one block and all the vendor information should be in
another block.

5 In the first cell in the blank row above each block of information, enter one
of the keywords shown in this table. Be sure to include the exclamation point
(!).

Type this text. . . If the block contains
!ACCNT Details about your chart of accounts.
!CUST A customer address or phone list.
!VEND A vendor address or phone list.
!EMP A list of employees.
!OTHERNAME A list of names you'd like to add to QuickBooks Other Name list.
!BUD Budget details.
!CLASS A list of general classifications you'd like to add to QuickBooks Class
list.
!CTYPE A list of customer classifications you'd like to add to QuickBooks
Customer Type list.
!INVITEM Details about the line items you use on sales and purchase forms.
!INVMEMO Messages you'd like to add to QuickBooks Customer Message list.
!PAYMETH A list of payment methods you'd like to add to QuickBooks Payment
Method list.
!SHIPMETH A list of shipping methods you'd like to add to QuickBooks Ship Via
list.
!TERMS A list of payment terms you'd like to add to QuickBooks Terms list.
!TIMEACT Details about activities you timed with the QuickBooks Pro Timer. Works
with !TIMERHDR.
!TIMERHDR QuickBooks Pro Timer data.
!TODO A list of upcoming to do tasks you want QuickBooks to remind you about.
!TRNS Transactions.
!VTYPE A list of vendor classifications you'd like to add to QuickBooks Vendor
Type list.
For example, if the spreadsheet contains a list of customers and then a list of
vendors, the structure of the spreadsheet would be as follows:
!CUST
[List of customers]
!VEND
[List of vendors]
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




RE: Quickbooks IIF files???

2004-08-23 Thread Ray Champagne
Thanks to both of the Mark's...

I will try out the second solution.

Sometimes you just gotta know where to look for the right info!

Ray

At 01:51 PM 8/23/2004, you wrote:
You are correct - the iif file is pretty much a comma delimited ascii 
file. The
answer you need is actually in the quickbooks help files - here's an excerpt.

-Mark

---

You may also want to refer to the Reference Guide to Import Files

Note: These instructions are rather long. You may want to print them 
instead of
reading them onscreen. To print them, click Options and then choose Print 
Topic.

If you've been using another financial software product, and you'd like to
import information from that product into QuickBooks, you can do so if the
product allows you to export to a spreadsheet or text file. You can import 
lists
that correspond to QuickBooks lists, budgets, and individual transactions.

Tip: The easiest way to see and understand the format QuickBooks needs to 
import
data is to export some of your QuickBooks lists and view the resulting 
file in a
spreadsheet. If you don't already have a QuickBooks company, you can export
lists from the sample data (sample_product-based business. Qbw or
sample_service-based business.qbw).

1 Open the spreadsheet that contains the data.
2 Move the contents of all the cells in your spreadsheet one column to the 
right
so that the first column is blank.
3 Move the contents of all the cells down by one row so that the first row is
blank.
4 Check the structure of the spreadsheet. If it contains more than one type of
listor a mixture of lists, budgets, and transactionsmake sure that each 
type of
information has its own block in the spreadsheet. The blocks should follow 
each
other vertically. Insert a blank row of cells to separate the blocks.

For example, it you have a list of customers and a list of vendors, all the
customer data should be in one block and all the vendor information should 
be in
another block.

5 In the first cell in the blank row above each block of information, 
enter one
of the keywords shown in this table. Be sure to include the exclamation point
(!).

Type this text. . . If the block contains
!ACCNT Details about your chart of accounts.
!CUST A customer address or phone list.
!VEND A vendor address or phone list.
!EMP A list of employees.
!OTHERNAME A list of names you'd like to add to QuickBooks Other Name list.
!BUD Budget details.
!CLASS A list of general classifications you'd like to add to QuickBooks Class
list.
!CTYPE A list of customer classifications you'd like to add to QuickBooks
Customer Type list.
!INVITEM Details about the line items you use on sales and purchase forms.
!INVMEMO Messages you'd like to add to QuickBooks Customer Message list.
!PAYMETH A list of payment methods you'd like to add to QuickBooks Payment
Method list.
!SHIPMETH A list of shipping methods you'd like to add to QuickBooks Ship Via
list.
!TERMS A list of payment terms you'd like to add to QuickBooks Terms list.
!TIMEACT Details about activities you timed with the QuickBooks Pro Timer. 
Works
with !TIMERHDR.
!TIMERHDR QuickBooks Pro Timer data.
!TODO A list of upcoming to do tasks you want QuickBooks to remind you 
about.
!TRNS Transactions.
!VTYPE A list of vendor classifications you'd like to add to QuickBooks Vendor
Type list.
For example, if the spreadsheet contains a list of customers and then a 
list of
vendors, the structure of the spreadsheet would be as follows:
!CUST
[List of customers]
!VEND
[List of vendors]





 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]
 [Donations and Support]




IIF doesn't work correctly

2004-03-19 Thread Robert Everland III
I was having some issues on IIF and thought I was using it correctly so I reverified it by looking at the examples in the book and if I copy an example directly out of the docs, it doesn't work. Try this in CFMX 6.1 #IIf(IsDefined(Form.Deliver), Evaluate(DE(Form.Deliver)), DE(no))#

That should output no and not throw an error, but on my box it does. Anyone know a workaround. The livedocs can be viewed here. http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/funct117.htm

bob Everland
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: IIF doesn't work correctly

2004-03-19 Thread Robert Everland III
I correct myself, the example works, but what I'm trying to do doesn't work. Can anyone look at this and see why it isn't working

#iif(listlen(cgi.query_string, ) gt 1, Evaluate(DE(listdeleteat(listdeleteat(cgi.query_string, 1, ), 1, =))), DE(test))#

The cgi query_string will have either fuseaction=login.login or fuseaction=login.loginfa=something.else , that way if I am passing the extra fa I want them to be redirected to that fa after login.

Bob

 I was having some issues on IIF and thought I was using it correctly 
 so I reverified it by looking at the examples in the book and if I 
 copy an example directly out of the docs, it doesn't work. Try this in 
 CFMX 6.1 #IIf(IsDefined(Form.Deliver), Evaluate(DE(Form.Deliver)), 
 DE(no))#
 
 That should output no and not throw an error, but on my box it does. 
 Anyone know a workaround. The livedocs can be viewed here. 
 http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/funct117.htm
 
 
 bob 
Everland
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: IIF doesn't work correctly

2004-03-19 Thread Dave Watts
 I was having some issues on IIF and thought I was using it 
 correctly so I reverified it by looking at the examples in 
 the book and if I copy an example directly out of the docs, 
 it doesn't work. Try this in CFMX 6.1 
 #IIf(IsDefined(Form.Deliver), Evaluate(DE(Form.Deliver)), 
 DE(no))#
 
 That should output no and not throw an error, but on my box 
 it does. Anyone know a workaround. The livedocs can be viewed 
 here. 
 http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/funct117.htm

I haven't actually tried running your code, but why would you nest DE within
Evaluate? You should be able to simplify the _expression_:

#IIf(IsDefined(Form.Deliver), Form.Deliver, DE(no))

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
phone: 202-797-5496
fax: 202-797-5444
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




RE: IIF doesn't work correctly

2004-03-19 Thread Pascal Peters
It's a bit overcomplicated (evaluate and de cancel each other AFAIK),
but your problem is with quotes 
Evaluate(DE(listdeleteat(listdeleteat(cgi.query_string, 1, ''), 1,
'=')))

Pascal
 -Original Message-
 From: Robert Everland III [mailto:[EMAIL PROTECTED] 
 Sent: vrijdag 19 maart 2004 15:45
 To: CF-Talk
 Subject: Re: IIF doesn't work correctly
 
 I correct myself, the example works, but what I'm trying to 
 do doesn't work. Can anyone look at this and see why it isn't working
 
 #iif(listlen(cgi.query_string, ) gt 1, 
 Evaluate(DE(listdeleteat(listdeleteat(cgi.query_string, 1, 
 ), 1, =))), DE(test))#
 
 The cgi query_string will have either fuseaction=login.login 
 or fuseaction=login.loginfa=something.else , that way if I 
 am passing the extra fa I want them to be redirected to that 
 fa after login.
 
 
 Bob
 
 
 
  I was having some issues on IIF and thought I was using it 
 correctly 
  so I reverified it by looking at the examples in the book and if I 
  copy an example directly out of the docs, it doesn't work. 
 Try this in 
  CFMX 6.1 #IIf(IsDefined(Form.Deliver), 
 Evaluate(DE(Form.Deliver)), 
  DE(no))#
  
  That should output no and not throw an error, but on my box 
 it does. 
  Anyone know a workaround. The livedocs can be viewed here. 
  http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/funct117.htm
  
  
  bob
 Everland
 

 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




Re: IIF doesn't work correctly

2004-03-19 Thread Robert Everland III
I figured it out, must not put double quotes.

Bob

 I correct myself, the example works, but what I'm trying to do doesn't 
 work. Can anyone look at this and see why it isn't working
 
 #iif(listlen(cgi.query_string, ) gt 1, 
 Evaluate(DE(listdeleteat(listdeleteat(cgi.query_string, 1, ), 1, 
 =))), DE(test))#
 
 The cgi query_string will have either fuseaction=login.login or 
 fuseaction=login.loginfa=something.else , that way if I am passing 
 the extra fa I want them to be redirected to that fa after login.
 
 
 Bob
 
 
 
  I was having some issues on IIF and thought I was using it correctly 
 
  so I reverified it by looking at the examples in the book and if I 
  copy an example directly out of the docs, it doesn't work. Try this 
 in 
  CFMX 6.1 #IIf(IsDefined(Form.Deliver), Evaluate(DE(Form.
 Deliver)), 
  DE(no))#
  
  That should output no and not throw an error, but on my box it does. 
 
  Anyone know a workaround. The livedocs can be viewed here. 
  http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/funct117.htm
  
  
  bob 
Everland
 [Todays Threads] 
 [This Message] 
 [Subscription] 
 [Fast Unsubscribe] 
 [User Settings]




IIF() and IsDefined()

2003-04-04 Thread Alexander Sherwood
Help:

#IIF(StructKeyExists(struct, 'keyname'),DE(struct.keyname),DE('no 
key'))#.fails if the key is not present.

BUT,

cfif StructKeyExists(struct, 'keyname')
#struct.keyname#
cfelse
no key
/cfif

doesn't.

Am I missing something about IIF() and DE()? It looks as if both DE() 
expressions must be evaluateable, and the IIF() just decides which one to 
evaluate? Correct?

Thanks,

--
Alex Sherwood
PHS Collection Agency
THE COLLECTORS
T:   301.215.4200
F:   301.664.6834
W: www.phs-net.com

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: IIF() and IsDefined()

2003-04-04 Thread Tangorre, Michael
try quotes around the argument passed to DE.
DE(struct.keyname) should be DE('struct.keyname')

mike

-Original Message-
From: Alexander Sherwood [mailto:[EMAIL PROTECTED]
Sent: Friday, April 04, 2003 2:36 PM
To: CF-Talk
Subject: IIF() and IsDefined()


Help:

#IIF(StructKeyExists(struct, 'keyname'),DE(struct.keyname),DE('no 
key'))#.fails if the key is not present.

BUT,

cfif StructKeyExists(struct, 'keyname')
#struct.keyname#
cfelse
no key
/cfif

doesn't.

Am I missing something about IIF() and DE()? It looks as if both DE() 
expressions must be evaluateable, and the IIF() just decides which one to 
evaluate? Correct?

Thanks,

--
Alex Sherwood
PHS Collection Agency
THE COLLECTORS
T:   301.215.4200
F:   301.664.6834
W: www.phs-net.com


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
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

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: IIF() and IsDefined()

2003-04-04 Thread Barney Boisvert
you don't need the de() call around the variable name, just put it in
quotes:

iif(structKeyExists(struct, keyname), struct.keyname, de(no key))

Your code was trying to output a variable with a name equal to the value
stored in #struct.keyname#, which isn't what you wanted.

Usually, using CFIF is more readable (especially with complex expressions)
and it's always faster, as it doesn't require any delayed evaluation (which
is slow).  Sometimes it's the only way to get a job done, but you generally
shouldn't use it unless you have to.

barneyb

---
Barney Boisvert, Senior Development Engineer
AudienceCentral (formerly PIER System, Inc.)
[EMAIL PROTECTED]
voice : 360.756.8080 x12
fax   : 360.647.5351

www.audiencecentral.com

 -Original Message-
 From: Alexander Sherwood [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 04, 2003 11:36 AM
 To: CF-Talk
 Subject: IIF() and IsDefined()


 Help:

 #IIF(StructKeyExists(struct, 'keyname'),DE(struct.keyname),DE('no
 key'))#.fails if the key is not present.

 BUT,

 cfif StructKeyExists(struct, 'keyname')
 #struct.keyname#
 cfelse
 no key
 /cfif

 doesn't.

 Am I missing something about IIF() and DE()? It looks as if both DE()
 expressions must be evaluateable, and the IIF() just decides
 which one to
 evaluate? Correct?

 Thanks,

 --
 Alex Sherwood
 PHS Collection Agency
 THE COLLECTORS
 T:   301.215.4200
 F:   301.664.6834
 W: www.phs-net.com

 
~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



Re: Iif() and StructKeyExist()

2003-02-23 Thread Jann VanOver
On 2/20/03 1:17 PM, Aidan Whitehall [EMAIL PROTECTED]
wrote:

 I've got an array of structures and am looping through them and writing
 several queries on the fly. However, I can't hit on just the right
 combination of quotation marks to stop it throwing an error.
 
 Does anyone know how to write it correctly, outputting either null or
 the value surrounded by apostrophes?

A change in direction would be to consider if you could construct your
queries with CFQUERYPARAM.  Then you wouldn't need to worry about quoting or
apostrophes.

I'm not good off-the-cuff with cfqueryparam.  I'm sure someone here can give
a good example of a null check added to a cfqueryparam ... Any takers?

 
 #Iif(not StructKeyExists(values[i], proximity), DE(null), ' 
 values[i][proximity]  '))#
 
 
 Thanks!

~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: Iif() and StructKeyExist()

2003-02-22 Thread Aidan Whitehall
 I don't think you can use IIF in this case as IIF has
 a habit of evaluating both results regardless of
 whether it resolves to true or false. Even if
 proximity doesn't exist, it will still evaluate
 values[i][proximity].

Yeah, that's how it's starting to look. Well, thanks for the
confirmation. Guess it's a job for cfif.


-- 
Aidan Whitehall [EMAIL PROTECTED]
Macromedia ColdFusion Developer
Fairbanks Environmental Ltd  +44 (0)1695 51775


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4



RE: Iif() and StructKeyExist()

2003-02-21 Thread David Collie (itndac)
dont have time to test, but would it not need to something like this???

#Iif(not StructKeyExists(values[i], proximity), DE(null), 
DE(values[i][proximity])))#

You would then need to check the value and decide whether   quotes would work

Could be wrong... my 2 secs worth

-Original Message-
From: Aidan Whitehall [mailto:[EMAIL PROTECTED]]
Sent: 20 February 2003 21:18
To: CF-Talk
Subject: Iif() and StructKeyExist()


I've got an array of structures and am looping through them and writing
several queries on the fly. However, I can't hit on just the right
combination of quotation marks to stop it throwing an error.

Does anyone know how to write it correctly, outputting either null or
the value surrounded by apostrophes?

#Iif(not StructKeyExists(values[i], proximity), DE(null), ' 
values[i][proximity]  '))#


Thanks!

-- 
Aidan Whitehall [EMAIL PROTECTED]
Macromedia ColdFusion Developer
Fairbanks Environmental Ltd  +44 (0)1695 51775



~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




RE: Iif() and StructKeyExist()

2003-02-21 Thread mark brinkworth
I don't think you can use IIF in this case as IIF has
a habit of evaluating both results regardless of
whether it resolves to true or false. Even if
proximity doesn't exist, it will still evaluate
values[i][proximity].



Cheers

 
 I've got an array of structures and am looping
 through them and writing
 several queries on the fly. However, I can't hit on
 just the right
 combination of quotation marks to stop it throwing
 an error.
 
 Does anyone know how to write it correctly,
 outputting either null or
 the value surrounded by apostrophes?
 
 #Iif(not StructKeyExists(values[i], proximity),
 DE(null), ' 
 values[i][proximity]  '))#
 
 
 Thanks!
 
 -- 
 Aidan Whitehall [EMAIL PROTECTED]
 Macromedia ColdFusion Developer
 Fairbanks Environmental Ltd  +44 (0)1695 51775
 
 
 


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




Iif() and StructKeyExist()

2003-02-20 Thread Aidan Whitehall
I've got an array of structures and am looping through them and writing
several queries on the fly. However, I can't hit on just the right
combination of quotation marks to stop it throwing an error.

Does anyone know how to write it correctly, outputting either null or
the value surrounded by apostrophes?

#Iif(not StructKeyExists(values[i], proximity), DE(null), ' 
values[i][proximity]  '))#


Thanks!

-- 
Aidan Whitehall [EMAIL PROTECTED]
Macromedia ColdFusion Developer
Fairbanks Environmental Ltd  +44 (0)1695 51775


~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4




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.

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



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 cfif 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 cfif, 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:

cfset theMod = currentRow MOD 2
td class=alternateRowColor#theMod#
..
/td

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 cfif 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 cfif, 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 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 cfif 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 cfif, 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 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 cfif 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 cfif, 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 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

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



iif usage

2002-09-08 Thread Ruslan Sivak

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

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

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 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 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 Ruslan Sivak

That's the whole point, Joe... I have the following code above it
cfif not qryCustomer.allareas 
cfquery name=qryAreas datasource=#request.dsn#
somequery
/cfquery
/cfif

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



  1   2   3   >