cfdocs

queryRowSwap

In a query object, swap the record in the sourceRow with the record from the destinationRow.

queryRowSwap(query, sourceRow, destinationRow )
returns query

Member Function Syntax

query.rowSwap(sourceRow, destinationRow)

Argument Reference

Name Type Required Default Description
query query Yes   The original query object.
sourceRow numeric Yes   The row to swap.
destinationRow numeric Yes   The row to be swapped with.

Example1

This is Example1

qry=queryNew("rowid,name", "integer,varchar",[ [1, "Bob"],[2, "Theodore"],[3, "Jay"],[4, "William"] ]);
swap1=queryRowSwap(qry,1,4);
writeDump(swap1);

Member function version.

Using the member function.

qry=queryNew("rowid,name", "integer,varchar",[ [1, "Bob"],[2, "Theodore"],[3, "Jay"],[4, "William"] ]);
swap2=qry.rowSwap(1,4);
writeDump(swap2);