cfloop headache
What am I doing wrong here...I am trying to evaluate a field and change the outoput based on this. I know I have a few records that meet the cfif get.posted IS "GW" test but they dont get SET to 0 as if the test failed. It appears I am not evaluating on the correct record. Do I need to set a field from the query to a list then loop thru the list perhaps? Seems like I should be able to do it like this somehow... Thanks,Adrian Ive slimmed the query and output down to make it simple: CFQUERY NAME="get" DATASOURCE="blah" SELECT billno,posted,qty FROM blah WHERE blah /CFQUERY cfloop query="get" cfif posted IS "GW" !--- tried get.posted - same result --- cfset NewQty = 0 cfelse cfset NewQty = qty /cfif cfset txtoutput = '"#BillNo#"~"#NewQty#"' cffile action=append file="blah" output="#txtoutput#" /cfloop -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: cfloop headache
It should work. Are you sure about the data? If your datatype is CHAR(5), for example, the actual stored value would be "GW ", not "GW". How about RTRIM(posted) IS "GW"? -Original Message- From: Adrian Cesana [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 28, 2000 12:48 PM To: CF-Talk Subject: cfloop headache What am I doing wrong here...I am trying to evaluate a field and change the outoput based on this. I know I have a few records that meet the cfif get.posted IS "GW" test but they dont get SET to 0 as if the test failed. It appears I am not evaluating on the correct record. Do I need to set a field from the query to a list then loop thru the list perhaps? Seems like I should be able to do it like this somehow... Thanks,Adrian Ive slimmed the query and output down to make it simple: CFQUERY NAME="get" DATASOURCE="blah" SELECT billno,posted,qty FROM blah WHERE blah /CFQUERY cfloop query="get" cfif posted IS "GW" !--- tried get.posted - same result --- cfset NewQty = 0 cfelse cfset NewQty = qty /cfif cfset txtoutput = '"#BillNo#"~"#NewQty#"' cffile action=append file="blah" output="#txtoutput#" /cfloop -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: cfloop headache
To start, using Instead of using "is "GW"" which is not the most effecient try If any field posted in the query get is equal to GW it will do the first set, otherwise it will drop to the else set. Since you are in a single loop you do not have to use "get.posted". cfif not Compare(posted, "GW") set cfelse set /cfif One other comment :) doing cfset txtoutput = '"#BillNo#"~"#NewQty#"' Is kind if bad because you are using single quotes instead try escaping the double quotes which is your intention? that is 'proper' syntax below. And does the same thing you want, I have ran into problems using the single quotes some of the time so its a 'best practice' to avoid that. cfset txtoutput = """#BillNo#""~""#NewQty#""" Jeremy Allen [EMAIL PROTECTED] Insert Quarter Here ---[]--- -Original Message- From: Adrian Cesana [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 28, 2000 1:48 PM To: CF-Talk Subject: cfloop headache What am I doing wrong here...I am trying to evaluate a field and change the outoput based on this. I know I have a few records that meet the cfif get.posted IS "GW" test but they dont get SET to 0 as if the test failed. It appears I am not evaluating on the correct record. Do I need to set a field from the query to a list then loop thru the list perhaps? Seems like I should be able to do it like this somehow... Thanks,Adrian Ive slimmed the query and output down to make it simple: CFQUERY NAME="get" DATASOURCE="blah" SELECT billno,posted,qty FROM blah WHERE blah /CFQUERY cfloop query="get" cfif posted IS "GW" !--- tried get.posted - same result --- cfset NewQty = 0 cfelse cfset NewQty = qty /cfif cfset txtoutput = '"#BillNo#"~"#NewQty#"' cffile action=append file="blah" output="#txtoutput#" /cfloop -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: cfloop headache
The CFSET statement, cfset txtoutput = '"#BillNo#"~"#NewQty#"' looks "funny". What's with the tilde between the quoted strings? Did you mean: cfset txtoutput = "#BillNo#~#NewCity#" ?? Try "printing" the txtoutput values without the CFFILE and see what you are getting here. -Original Message- From: Adrian Cesana [SMTP:[EMAIL PROTECTED]] Sent: Thursday, September 28, 2000 10:48 AM To: CF-Talk Subject: cfloop headache What am I doing wrong here...I am trying to evaluate a field and change the outoput based on this. I know I have a few records that meet the cfif get.posted IS "GW" test but they dont get SET to 0 as if the test failed. It appears I am not evaluating on the correct record. Do I need to set a field from the query to a list then loop thru the list perhaps? Seems like I should be able to do it like this somehow... Thanks,Adrian Ive slimmed the query and output down to make it simple: CFQUERY NAME="get" DATASOURCE="blah" SELECT billno,posted,qty FROM blah WHERE blah /CFQUERY cfloop query="get" cfif posted IS "GW" !--- tried get.posted - same result --- cfset NewQty = 0 cfelse cfset NewQty = qty /cfif cfset txtoutput = '"#BillNo#"~"#NewQty#"' cffile action=append file="blah" output="#txtoutput#" /cfloop -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: cfloop headache
Try trimming the Posted field, in case you have any spaces in there. cfif trim(posted) IS "GW" Sharon At 10:48 AM 9/28/2000 -0700, Adrian Cesana wrote: What am I doing wrong here...I am trying to evaluate a field and change the outoput based on this. I know I have a few records that meet the cfif get.posted IS "GW" test but they dont get SET to 0 as if the test failed. It appears I am not evaluating on the correct record. Do I need to set a field from the query to a list then loop thru the list perhaps? Seems like I should be able to do it like this somehow... Thanks,Adrian Ive slimmed the query and output down to make it simple: CFQUERY NAME="get" DATASOURCE="blah" SELECT billno,posted,qty FROM blah WHERE blah /CFQUERY cfloop query="get" cfif posted IS "GW" !--- tried get.posted - same result --- cfset NewQty = 0 cfelse cfset NewQty = qty /cfif cfset txtoutput = '"#BillNo#"~"#NewQty#"' cffile action=append file="blah" output="#txtoutput#" /cfloop -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: cfloop headache
The program that reads the output file wants the tilde as a delimiter and double-quote as the text qualifier..(dont ask - Italian programmer). I know that portion works fine and perhaps I will go back to escaping the double quotes. I used to do it that way but for some reason switched to the SET method, probably just being lazy. My problem is still setting the NewQty to 0 when POSTED = GW Adrian -Original Message- From: Jann VanOver [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 28, 2000 1:45 PM To: CF-Talk Subject: RE: cfloop headache The CFSET statement, cfset txtoutput = '"#BillNo#"~"#NewQty#"' looks "funny". What's with the tilde between the quoted strings? Did you mean: cfset txtoutput = "#BillNo#~#NewCity#" ?? Try "printing" the txtoutput values without the CFFILE and see what you are getting here. -Original Message- From: Adrian Cesana [SMTP:[EMAIL PROTECTED]] What am I doing wrong here...I am trying to evaluate a field and change the outoput based on this. I know I have a few records that meet the cfif get.posted IS "GW" test but they dont get SET to 0 as if the test failed. CFQUERY NAME="get" DATASOURCE="blah" SELECT billno,posted,qty FROM blah WHERE blah /CFQUERY cfloop query="get" cfif posted IS "GW" !--- tried get.posted - same result --- cfset NewQty = 0 cfelse cfset NewQty = qty /cfif cfset txtoutput = '"#BillNo#"~"#NewQty#"' cffile action=append file="blah" output="#txtoutput#" /cfloop -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.