QueryCurrentRow

Returns the current row number

Method Signature

QueryCurrentRow(query=[query])

Arguments

Argument
Type
Required
Description
Default

query

query

true

The query to get the current row number from

Examples

Simple QueryCurrentRow Example

Here we've example to get the currentRow number.

<bx:set myQuery = queryNew( "id,name", "integer,varchar", [ 
	[
		1,
		"Rajesh"
		],
	[
		2,
		"Anil"
		]
	] ) >
<bx:loop query="myQuery">
	<bx:if name == "Anil" >
		<bx:output>#queryCurrentRow( myQuery )#</bx:output>
	</bx:if>
</bx:loop>

Result: 2

Simple currentRow Example

Here we've example to get the currentRow number from query using script syntax.

<bx:script>
	var myQuery = queryNew( "id,title", "integer,varchar", [
		[
			1,
			"Charlottes Web"
		],
		[
			3,
			"The Outsiders"
		],
		[
			4,
			"Mieko and the Fifth Treasure"
		]
	] );
	bx:loop query="myQuery" {
		if( title == "Mieko and the Fifth Treasure" ) {
			writeOutput( myQuery.currentRow() );
		}
	}
</bx:script>

Result: 3

Additional Examples

Run Example

myQry = QueryNew( "id,name", "Integer,VarChar", [ 
	[
		99,
		"sm"
	],
	[
		55,
		"mk"
	]
] );
bx:loop query="myQry" {
	writeDump( querycurrentrow( myQry ) );
}

Last updated

Was this helpful?