RE: CFLoop query problem
Thanks everyone for taking time to respond. All great ideas. I got it fixed. Thanks, Mark -Original Message- From: Shawn Kernes [mailto:skernes@;liquidseats.com] Sent: Thursday, October 31, 2002 2:44 PM To: CF-Talk Subject: RE: CFLoop query problem Try this -Original Message- From: Mark Leder [mailto:mel@;markleder.com] Sent: Thursday, October 31, 2002 11:32 AM To: CF-Talk Subject: CFLoop query problem Hi All, I'm trying to loop through a query to add all the items contained in that query. This query set contains three records. When I do a CFOUTPUT inside the CFLOOP on the ItemPrice field, all three individual prices are returned in succession, but the tag only shows the first record. I want the tag to contain the sum of all three ItemPrice fields. What am I doing wrong? Thanks, Mark ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq 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
RE: CFLoop query problem
>>in succession, but the tag only shows the first >>record The way it's written, a new value for subTotalTaxable is set with every iteration. >> If I understand you, don't you want to add a value to the existing value contained in subTotalTaxable? FYI: ditch the extra #'s. -Craig ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq 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
RE: CFLoop query problem
Try this -Original Message- From: Mark Leder [mailto:mel@;markleder.com] Sent: Thursday, October 31, 2002 11:32 AM To: CF-Talk Subject: CFLoop query problem Hi All, I'm trying to loop through a query to add all the items contained in that query. This query set contains three records. When I do a CFOUTPUT inside the CFLOOP on the ItemPrice field, all three individual prices are returned in succession, but the tag only shows the first record. I want the tag to contain the sum of all three ItemPrice fields. What am I doing wrong? Thanks, Mark ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk 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
Re: CFLoop query problem
Where is your code now? Your code is probabaly not right. do something like #myQry.fieldName# #qSum# I would suggest you use an arrray to for the price field.. some like aPrz=arrayNew(1); aPrz=ListToArray(valueList(mQry.ItemPrice),","); #arraySum(aPrz)# The above is much cleaner. Joe On Thu, 31 Oct 2002 14:32:04 -0500 Mark Leder <[EMAIL PROTECTED]> wrote: > Hi All, > I'm trying to loop through a query to add all > the items contained in > that query. > > This query set contains three records. When I > do a CFOUTPUT inside the > CFLOOP on the ItemPrice field, all three > individual prices are returned > in succession, but the tag only shows the > first > record. I want the tag to contain the sum of > all three ItemPrice > fields. What am I doing wrong? > > > > > > > > > Thanks, > Mark > > ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.
RE: CFLoop query problem
What is happening, you are getting the LAST record in the query to populate the values. What is it you are attempting?? If you want an Overall total of ItemPrice Then is OrderTotal already defined? If you are want to loop and continually add the values until the end of the query is reached then you can do something as follows: -Original Message- From: Mark Leder [mailto:mel@;markleder.com] Sent: Thursday, October 31, 2002 2:32 PM To: CF-Talk Subject: CFLoop query problem Hi All, I'm trying to loop through a query to add all the items contained in that query. This query set contains three records. When I do a CFOUTPUT inside the CFLOOP on the ItemPrice field, all three individual prices are returned in succession, but the tag only shows the first record. I want the tag to contain the sum of all three ItemPrice fields. What am I doing wrong? Thanks, Mark ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.
RE: CFLoop query problem
if not, what about adding the values to an array, in the cfloop, then do the ArraySum() function. ..tony Tony Weeg Senior Web Developer Information System Design Navtrak, Inc. Fleet Management Solutions www.navtrak.net 410.548.2337 -Original Message- From: Mark Leder [mailto:mel@;markleder.com] Sent: Thursday, October 31, 2002 2:32 PM To: CF-Talk Subject: CFLoop query problem Hi All, I'm trying to loop through a query to add all the items contained in that query. This query set contains three records. When I do a CFOUTPUT inside the CFLOOP on the ItemPrice field, all three individual prices are returned in succession, but the tag only shows the first record. I want the tag to contain the sum of all three ItemPrice fields. What am I doing wrong? Thanks, Mark ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.
RE: CFLoop query problem
mark. can u use some sql logic herelike this select Sum(ItemPrice) as OrderTotal from Blah.. ..tony Tony Weeg Senior Web Developer Information System Design Navtrak, Inc. Fleet Management Solutions www.navtrak.net 410.548.2337 -Original Message- From: Mark Leder [mailto:mel@;markleder.com] Sent: Thursday, October 31, 2002 2:32 PM To: CF-Talk Subject: CFLoop query problem Hi All, I'm trying to loop through a query to add all the items contained in that query. This query set contains three records. When I do a CFOUTPUT inside the CFLOOP on the ItemPrice field, all three individual prices are returned in succession, but the tag only shows the first record. I want the tag to contain the sum of all three ItemPrice fields. What am I doing wrong? Thanks, Mark ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk 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
RE: CFLoop query problem
I suspect it has to do with you adding OrderTotal and ItemPrice and putting it in SubTotalTaxable. I think you want to add SubTotalTaxable and ItemPrice, like this: By the way, you don't need the # signs the way you are using them. > -Original Message- > From: Mark Leder [mailto:mel@;markleder.com] > Sent: Thursday, October 31, 2002 2:32 PM > To: CF-Talk > Subject: CFLoop query problem > > > Hi All, > I'm trying to loop through a query to add all the items contained in > that query. > > This query set contains three records. When I do a CFOUTPUT > inside the > CFLOOP on the ItemPrice field, all three individual prices > are returned > in succession, but the tag only shows > the first > record. I want the tag to contain the sum of all three ItemPrice > fields. What am I doing wrong? > > > > > > > > > Thanks, > Mark > > ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk FAQ: http://www.thenetprofits.co.uk/coldfusion/faq 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