[cfaussie] Re: query function to delete a row from a query
is there anything wrong with doing a query to leave behind what you don't want? cfquery dbtype=query name=temp select * from origQofQ where not #condition# /cfquery cfset origQofQ = temp / On 4/6/06, Steve Onnis [EMAIL PROTECTED] wrote: Just my opinion, but that UDF is yuk. Imagine looping over a large query -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dale Fraser Sent: Friday, April 07, 2006 6:57 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: query function to delete a row from a query From cflib, cflib is your friend. cfscript /** * Removes rows from a query. * Added var col = ; * No longer using Evaluate. Function is MUCH smaller now. * * @param Query Query to be modified * @param Rows Either a number or a list of numbers * @return This function returns a query. * @author Raymond Camden ([EMAIL PROTECTED]) * @version 2, October 11, 2001 */ function QueryDeleteRows(Query,Rows) { var tmp = QueryNew(Query.ColumnList); var i = 1; var x = 1; for(i=1;i lte Query.recordCount; i=i+1) { if(not ListFind(Rows,i)) { QueryAddRow(tmp,1); for(x=1;x lte ListLen(tmp.ColumnList);x=x+1) { QuerySetCell(tmp, ListGetAt(tmp.ColumnList,x), query[ListGetAt(tmp.ColumnList,x)][i]); } } } return tmp; } /cfscript Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Mercer Sent: Friday, 7 April 2006 17:54 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: query function to delete a row from a query doesnt look like you can do a delete in QoQ On 4/7/06, Andrew Mercer [EMAIL PROTECTED] wrote: Does anyone know if there is something like queryDeleteRow() {the opersite of queryAddRow()} in CF? google found this in a blueDragon file otherwise I guess i will have to do a QoQ to do it --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: query function to delete a row from a query
that is what I went with before the deleteRow functions came inOn 4/10/06, Barry Beattie [EMAIL PROTECTED] wrote:is there anything wrong with doing a query to leave behind what you don't want? cfquery dbtype=query name=tempselect * from origQofQwhere not #condition#/cfquerycfset origQofQ = temp /On 4/6/06, Steve Onnis [EMAIL PROTECTED] wrote: Just my opinion, but that UDF is yuk.Imagine looping over a large query -Original Message- From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of Dale Fraser Sent: Friday, April 07, 2006 6:57 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: query function to delete a row from a query From cflib, cflib is your friend. cfscript /*** Removes rows from a query.* Added var col = ;* No longer using Evaluate. Function is MUCH smaller now.** @param QueryQuery to be modified * @param Rows Either a number or a list of numbers* @return This function returns a query.* @author Raymond Camden ([EMAIL PROTECTED])* @version 2, October 11, 2001 */ function QueryDeleteRows(Query,Rows) { var tmp = QueryNew(Query.ColumnList); var i = 1; var x = 1; for(i=1;i lte Query.recordCount ; i=i+1) { if(not ListFind(Rows,i)) { QueryAddRow(tmp,1); for(x=1;x lte ListLen(tmp.ColumnList);x=x+1) { QuerySetCell(tmp, ListGetAt(tmp.ColumnList,x), query[ListGetAt(tmp.ColumnList,x)][i]); } } } return tmp; } /cfscript Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto: cfaussie@googlegroups.com] On Behalf Of Andrew Mercer Sent: Friday, 7 April 2006 17:54 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: query function to delete a row from a query doesnt look like you can do a delete in QoQ On 4/7/06, Andrew Mercer [EMAIL PROTECTED] wrote: Does anyone know if there is something like queryDeleteRow() {the opersite of queryAddRow()} in CF? google found this in a blueDragon file otherwise I guess i will have to do a QoQ to do it --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: query function to delete a row from a query
I ask in case of any performance reasons not to do so. I've left behind (previous project) an important tool/CFC that uses this leave behind query method in important areas. If I've made a faux pas in doing so, I'd like to know On 4/10/06, Andrew Mercer [EMAIL PROTECTED] wrote: that is what I went with before the deleteRow functions came in On 4/10/06, Barry Beattie [EMAIL PROTECTED] wrote: is there anything wrong with doing a query to leave behind what you don't want? cfquery dbtype=query name=temp select * from origQofQ where not #condition# /cfquery cfset origQofQ = temp / On 4/6/06, Steve Onnis [EMAIL PROTECTED] wrote: Just my opinion, but that UDF is yuk. Imagine looping over a large query -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dale Fraser Sent: Friday, April 07, 2006 6:57 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: query function to delete a row from a query From cflib, cflib is your friend. cfscript /** * Removes rows from a query. * Added var col = ; * No longer using Evaluate. Function is MUCH smaller now. * * @param Query Query to be modified * @param Rows Either a number or a list of numbers * @return This function returns a query. * @author Raymond Camden ([EMAIL PROTECTED]) * @version 2, October 11, 2001 */ function QueryDeleteRows(Query,Rows) { var tmp = QueryNew(Query.ColumnList); var i = 1; var x = 1; for(i=1;i lte Query.recordCount ; i=i+1) { if(not ListFind(Rows,i)) { QueryAddRow(tmp,1); for(x=1;x lte ListLen(tmp.ColumnList);x=x+1) { QuerySetCell(tmp, ListGetAt(tmp.ColumnList,x), query[ListGetAt(tmp.ColumnList,x)][i]); } } } return tmp; } /cfscript Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto: [EMAIL PROTECTED] On Behalf Of Andrew Mercer Sent: Friday, 7 April 2006 17:54 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: query function to delete a row from a query doesnt look like you can do a delete in QoQ On 4/7/06, Andrew Mercer [EMAIL PROTECTED] wrote: Does anyone know if there is something like queryDeleteRow() {the opersite of queryAddRow()} in CF? google found this in a blueDragon file otherwise I guess i will have to do a QoQ to do it --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: query function to delete a row from a query
you could just do a QofQ WHERE id something and if you use cfquery name=sameNameAsExistsingQuery, it would be the same thing HTH On 4/7/06, Andrew Mercer [EMAIL PROTECTED] wrote: doesnt look like you can do a delete in QoQ On 4/7/06, Andrew Mercer [EMAIL PROTECTED] wrote: Does anyone know if there is something like queryDeleteRow() {the opersite of queryAddRow()} in CF? google found this in a blueDragon file otherwise I guess i will have to do a QoQ to do it -- www.gavcooney.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: query function to delete a row from a query
doesnt look like you can do a delete in QoQOn 4/7/06, Andrew Mercer [EMAIL PROTECTED] wrote: Does anyone know if there is something like queryDeleteRow() {the opersite of queryAddRow()} in CF? google found this in a blueDragon fileotherwise I guess i will have to do a QoQ to do it --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: query function to delete a row from a query
Andrew Dont say i never do anything for you:P cfscript function queryDeleteRow(query, row) { var cols = structNew(); var i = 0; var numberOfColumns = listLen(query.columnList); var returnQry = queryNew(); for (i = 1; i LTE numberOfColumns; i = i + 1) { valueListStr = evaluate(valueList(query.#listGetAt(query.columnList, i)#)); valueListStr = IIF(left(valueListStr, 1) EQ , , DE( ), DE()) valueListStr IIF(right(valueListStr, 1) EQ , , DE( ), DE()); #listGetAt(query.columnList, i)# = listToArray(#replace(valueListStr, ',,', ', ,', 'ALL')#); arrayDeleteAt(evaluate(listGetAt(query.columnList, i)), row); queryAddColumn(returnQry, listGetAt(query.columnList, i), evaluate(listGetAt(query.columnList, i))); } return returnQry; } /cfscript see how you go with that Regards Steve Onnis -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] Behalf Of Andrew Mercer Sent: Friday, April 07, 2006 5:54 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: query function to delete a row from a query doesnt look like you can do a delete in QoQ On 4/7/06, Andrew Mercer [EMAIL PROTECTED] wrote: Does anyone know if there is something like queryDeleteRow() {the opersite of queryAddRow()} in CF? google found this in a blueDragon file otherwise I guess i will have to do a QoQ to do it --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---