QueryRowSwap

Description

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.

Returns

A query object.

Category

Syntax

QueryRowSwap(query, sourceRow, destinationRow)

Member function

query.Swap(sourceRow, destinationRow)

History

New in ColdFusion (2018 release) Update 5.

Parameters

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.

See also

Example

<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>

Output

Query object before swap

Query object after swapping rows 2 and 3

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online