QueryRowSwap

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

Method Signature

QueryRowSwap(query=[query], source=[numeric], destination=[numeric])

Arguments

Argument
Type
Required
Description
Default

query

query

true

The query to swap a row with

source

numeric

true

The row to swap from

destination

numeric

true

The row to swap to

Examples

Example1

This is Example1

Run Example

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.

Run Example

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

Additional Examples

Run Example

qry = queryNew( "id,name", "integer,varchar", [ 
	[
		1,
		"a"
	],
	[
		2,
		"b"
	],
	[
		3,
		"c"
	]
] );
swapped = QueryRowSwap( qry, 2, 3 );
dump( swapped );
dump( qry );

Last updated

Was this helpful?