Swaps the contents of a row with a specified row in a query object.
For example, you can swap a record in sourceRow with the record of destinationRow.
1 | QueryRowSwap(query, sourceRow, destinationRow) |
1 | query.Swap(sourceRow, destinationRow) |
Parameter |
Required/Optional |
Description |
Query |
Required |
The query object where the rows are to be swapped. |
sourceRow |
Required |
The row to swap. |
destinationRow |
Required |
The row to be swapped with. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | < cfscript > myQuery1= queryNew ( "empid,depid,name" , "integer,integer,varchar" ,[ [10, 101, "John" ], [20, 120, "James" ], [30, 205, "Peter" ] ]); myQuery2= queryNew ( "empid,depid,name" , "integer,integer,varchar" ,[ [40, 530, "Jacob" ], [50, 306, "Mary" ], [60, 120, "Helen" ] ]) QueryAppend(myquery1,myquery2) WriteOutput ( "Query object before swap" ) WriteDump(myquery1) swapped=QueryRowSwap(myquery1,2,3) // Swap the records in position 2 and 3 WriteOutput ( "Query object after swapping rows 2 and 3" ) WriteDump(swapped) </ cfscript > |