How can that be the same as arrayAppend() ? I am trying to insert the row in one pass. Im not looping over the rows here, just the columns. If the query has 2 records in it and I want to for some reason insert a new row in row 15, arrayAppend() will add the new row into position 3, not position 15.
The function was built to add the row "anywhere" in the recordset, not just at the start or at the end of it. Using this method I can extend the recordset to what ever number of rows I want to without the function erroring. Steve -----Original Message----- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Scott Sent: Thursday, 15 May 2008 12:11 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: queryAddRow Steve, That is not answering my question. I can understand what you are doing, but I asked the question because of this if (position GT query.recordCount) { arrayResize( columnStruct[columns[c]], rowCount); arraySet( columnStruct[columns[c]], position, position, IIF(structKeyExists(rowData, columns[c]), "rowData[columns[c]]", "''") ); } To me that is the same as ArrayAppend, and I am curious why you didn't just use ArrayAppend at this point. The rest makes perfect sense. And that is not in the comments as to why you did not used ArrayAppend. Because this would do the exact same thing you are doing. arrayAppend(columnStruct[columns[c]], IIF(structKeyExists(rowData, columns[c]), "rowData[columns[c]]", "''") ); Andrew Scott Senior Coldfusion Developer Aegeon Pty. Ltd. www.aegeon.com.au Phone: +613 9015 8628 Mobile: 0404 998 273 -----Original Message----- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Steve Onnis Sent: Thursday, 15 May 2008 11:40 AM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: queryAddRow Its in the comments:) I made the function so you can insert the row anywhere in the recordset, not just at the end of at the start. If you use arrayInsertAt() and the position is larger than the actual size of the array then it fails so I had to resize the array and then use arraySet() because arrayInsertAt() would add a new element which I didn't want to do because the array was at the right size after the resize. ArrayAppend() would just "append" an element to the array where if the new row was at position 10 and the query only had 5 records then you would have to call arrayAppend() a few times to get the elements in there. Steve -----Original Message----- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Scott Sent: Thursday, 15 May 2008 10:40 AM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: queryAddRow Steve, Can you explain why you used, ArrayResize() and ArraySet() instead of ArrayAppend()? Andrew Scott Senior Coldfusion Developer Aegeon Pty. Ltd. www.aegeon.com.au Phone: +613 9015 8628 Mobile: 0404 998 273 --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---