Re: Trouble getting this loop to work ...
I have to agree with Gert on this one. That function needs to be rewritten so that it can accept a list of values. Would be interesting to see what the function is doing too. Running multiple queries in that way is unnecessarily network heavy. Gary Gilbert http://www.garyrgilbert.com/blog On Thu, Sep 18, 2008 at 6:03 PM, Gert Franz [EMAIL PROTECTED] wrote: Well of course, you overwrite the query every time you iterate to the next value. The query always has the same name, so CFMX overwrites it. Nevertheless it is a bad solution. You should do something like this: cfquery name=getCateories... select * from categories where category in ('#mcategories#') /cfquery You could of course have your form, where the user selects the categories store the categoryID's and then do an in over these categoryID's Greetings from Switzerland Gert Franz Railo Technologies GmbH [EMAIL PROTECTED] www.railo.ch Join our Mailing List german:http://de.groups.yahoo.com/group/railo/ english: http://groups.yahoo.com/group/railo_talk/ linked in: http://www.linkedin.com/e/gis/71368/0CF7D323BBC1 John Seelye schrieb: Thanks for the reply. ROL.getcategorydetailnames() Is actually a PostGRESQL function that is called within the cfquery ... The function only accepts one input (an integer) per iteration, so in my form that calls this page when someone selects more than one category I need the entire query to execute (and give output) for each category id ... (#mcategories#). The way I have it written it only gives the output for the last category id passed to it. The output I am looking for would look something like ... Category 1 - thing 1, thing 2, thing 3, thing 4 Category 2 - thing 11, thing 12, thing 13, thing 14 Category 3 - thing 20, thing 21 and so on ... I need to get the categories from user input and the things from the database with that function. The function works like a charm with just 1 category passed to it. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:313046 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Trouble getting this loop to work ...
John... THere's something wrong with your code. Shouldn't it read: If mcategories is a fieldvalue: cfloop list=#mcategory# index=mcategories delimiters=, cfquery name=qGetMList datasource=ROL select * from tablename where categories = #getcategorydetailnames(mcategories)#; /cfquery /cfloop When it's a tablename then it should read: cfloop list=#mcategory# index=mcategories delimiters=, cfquery name=qGetMList datasource=ROL select * from #getcategorydetailnames(mcategories)#; /cfquery /cfloop Or am I getting something wrong here... Greetings from Switzerland Gert Franz Railo Technologies GmbH [EMAIL PROTECTED] www.railo.ch Join our Mailing List german:http://de.groups.yahoo.com/group/railo/ english: http://groups.yahoo.com/group/railo_talk/ linked in: http://www.linkedin.com/e/gis/71368/0CF7D323BBC1 John Seelye schrieb: Having trouble getting this loop to work. I'm not sure anymore if it is even possible, but it seemed like a good way to go at the start. What I'm trying to do is have the loop take the list (it can be anything from 1 to 42 items long) from a form and then run the function in the cfquery for each item in the list and keep the output from each iteration of the query in #mcategories# cfloop list=#mcategory# index=mcategories delimiters=, cfquery name=qGetMList datasource=ROL select * from ROL.getcategorydetailnames(#mcategories#); /cfquery /cfloop ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312750 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Trouble getting this loop to work ...
Thanks for the reply. ROL.getcategorydetailnames() Is actually a PostGRESQL function that is called within the cfquery ... The function only accepts one input (an integer) per iteration, so in my form that calls this page when someone selects more than one category I need the entire query to execute (and give output) for each category id ... (#mcategories#). The way I have it written it only gives the output for the last category id passed to it. The output I am looking for would look something like ... Category 1 - thing 1, thing 2, thing 3, thing 4 Category 2 - thing 11, thing 12, thing 13, thing 14 Category 3 - thing 20, thing 21 and so on ... I need to get the categories from user input and the things from the database with that function. The function works like a charm with just 1 category passed to it. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312769 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Trouble getting this loop to work ...
Well of course, you overwrite the query every time you iterate to the next value. The query always has the same name, so CFMX overwrites it. Nevertheless it is a bad solution. You should do something like this: cfquery name=getCateories... select * from categories where category in ('#mcategories#') /cfquery You could of course have your form, where the user selects the categories store the categoryID's and then do an in over these categoryID's Greetings from Switzerland Gert Franz Railo Technologies GmbH [EMAIL PROTECTED] www.railo.ch Join our Mailing List german:http://de.groups.yahoo.com/group/railo/ english: http://groups.yahoo.com/group/railo_talk/ linked in: http://www.linkedin.com/e/gis/71368/0CF7D323BBC1 John Seelye schrieb: Thanks for the reply. ROL.getcategorydetailnames() Is actually a PostGRESQL function that is called within the cfquery ... The function only accepts one input (an integer) per iteration, so in my form that calls this page when someone selects more than one category I need the entire query to execute (and give output) for each category id ... (#mcategories#). The way I have it written it only gives the output for the last category id passed to it. The output I am looking for would look something like ... Category 1 - thing 1, thing 2, thing 3, thing 4 Category 2 - thing 11, thing 12, thing 13, thing 14 Category 3 - thing 20, thing 21 and so on ... I need to get the categories from user input and the things from the database with that function. The function works like a charm with just 1 category passed to it. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312772 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Trouble getting this loop to work ...
Having trouble getting this loop to work. I'm not sure anymore if it is even possible, but it seemed like a good way to go at the start. What I'm trying to do is have the loop take the list (it can be anything from 1 to 42 items long) from a form and then run the function in the cfquery for each item in the list and keep the output from each iteration of the query in #mcategories# cfloop list=#mcategory# index=mcategories delimiters=, cfquery name=qGetMList datasource=ROL select * from ROL.getcategorydetailnames(#mcategories#); /cfquery /cfloop ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312726 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4