Andrew,
Does it matter?
Steve is just trying to build in some flexibility and he should be applauded
for that. Just because you might not be able to think of a reason to use that
flexibility doesn't mean he needs to justify it to you.
Sure, make your point but don't harp on it.
Brett
B)
Andrew Scott wrote:
> Steve,
>
> That doesn't make sense to me, why would you need to call arrayAppend 12
> times, when you have a condition like this?
>
> if (position GT query.recordCount) {
>
> That one line, is checking to see if it needs to go to the end of the query.
>
> I did also ask if it was your intention to insert at 10 elements above the
> size of the query, and why anyone would actually do that is beyond me.
>
> So my question stands, but of course I doubt you actually tried it with the
> arrayAppends. Here is your code output and underneath that is mine using
> ArrayAppend.
>
> I still don't understand why you want that many null records?
>
> Steves Code:
> ------------
>
> query [long version]
> fruit vegies
> 1 banana carrot
> 2 apple cucumber
> 3 orange tomato
> 4 [null] [null]
> 5 [null] [null]
> 6 [null] [null]
> 7 [null] [null]
> 8 [null] [null]
> 9 [null] [null]
> 10 [null] [null]
> 11 [null] [null]
> 12 [null] [null]
> 13 [null] [null]
> 14 [null] [null]
> 15 [null] [null]
> 16 Test Andrew
> Query Source: QueryNew()
>
>
> ArrayAppend Code:
> -----------------
>
> query [long version]
> fruit vegies
> 1 banana carrot
> 2 apple cucumber
> 3 orange tomato
> 4 Test Andrew
> Query Source: QueryNew()
>
>
>
>
> Andrew Scott
> Senior Coldfusion Developer
> Aegeon Pty. Ltd.
> www.aegeon.com.au
> Phone: +613 9015 8628
> Mobile: 0404 998 273
>
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
> Of Steve Onnis
> Sent: Thursday, 15 May 2008 12:25 PM
> To: [email protected]
> Subject: [cfaussie] Re: queryAddRow
>
>
>
> The object is to insert a row into a recordset. It shouldn't matter where
> you insert it. My method creates a new query with the row in the right spot
> leaving the rest of the row empty if required. If you use arrayAppend() for
> your example, I would have to call arrayAppend() 12 times before I could set
> the array position of 15. Using arrayResize() I can resize the array in one
> go and just set the value of the array.
>
> Becoming clearer?
>
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
> Of Andrew Scott
> Sent: Thursday, 15 May 2008 12:15 PM
> To: [email protected]
> Subject: [cfaussie] Re: queryAddRow
>
>
> I should also add that with your method of not using ArrayAppend, creates
> empty records when doing this.
>
> Can you now see why I asked the original question? Or was that the desired
> effect you wanted?
>
> qry = queryNew("");
> queryAddColumn(qry, "fruit", listToArray("banana,apple,orange"));
> queryAddColumn(qry, "vegies", listToArray("carrot,cucumber,tomato"));
>
> newRow = structNew();
> newRow["fruit"] = "Test";
> newRow["vegies"] = "Andrew";
>
> qry = queryInsertRow( qry, 15, newRow);
>
>
> Andrew Scott
> Senior Coldfusion Developer
> Aegeon Pty. Ltd.
> www.aegeon.com.au
> Phone: +613 9015 8628
> Mobile: 0404 998 273
>
>
>
>
>
>
>
>
>
>
> >
>
>
--
Brett Payne-Rhodes
Eaglehawk Computing
t: +61 (0)8 9371-0471
m: +61 (0)414 371 047
e: [EMAIL PROTECTED]
w: http://www.yoursite.net.au
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cfaussie" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---