QueryDeleteRow
This function deletes a row from the query
Method Signature
QueryDeleteRow(query=[query], row=[integer])
Arguments
Argument
Type
Required
Description
Default
query
query
true
The query to delete the row from
row
integer
true
The row index to delete
Examples
Implicit deletion of the last row
Builds a simple query and removes the last row by not specifying a row index.
news = queryNew( "id,title", "integer,varchar", [
{
"id" : 1,
"title" : "Dewey defeats Truman"
},
{
"id" : 2,
"title" : "Man walks on Moon"
}
] );
queryDeleteRow( news );
writeOutput( news[ "title" ][ 1 ] );
Result: Dewey defeats Truman
Deletes a specific row from the query
Builds a simple query and removes one of the rows.
news = queryNew( "id,title", "integer,varchar", [
{
"id" : 1,
"title" : "Dewey defeats Truman"
},
{
"id" : 2,
"title" : "Man walks on Moon"
}
] );
queryDeleteRow( news, 1 );
writeOutput( news[ "title" ][ 1 ] );
Result: Man walks on Moon
Additional Examples
qry1 = queryNew( "a,b,c", "varchar,varchar,varchar", [
[
"a1",
"b1",
"c1"
],
[
"a2",
"b2",
"c2"
],
[
"a3",
"b3",
"c3"
]
] );
queryDeleteRow( qry1, 2 );
writeDump( queryColumnData( qry1, "a" ).toList() );
qry2 = queryNew( "a,b,c", "varchar,varchar,varchar", [
[
"a1",
"b1",
"c1"
],
[
"a2",
"b2",
"c2"
],
[
"a3",
"b3",
"c3"
]
] );
for( i = 3; i >= 1; i-- ) {
queryDeleteRow( qry2, i );
}
writeDump( qry2.RECORDCOUNT );
Related
Last updated
Was this helpful?