QueryKeyExists

This function returns true if the key exists in the query

Method Signature

QueryKeyExists(query=[query], key=[string])

Arguments

Argument
Type
Required
Description
Default

query

query

true

The query to check for the key

key

string

true

The key to check for

Examples

Check to see if column exists in Query

Uses the member function syntax

Run Example

news = queryNew( "id,title", "integer,varchar", [ 
	{
		"id" : 1,
		"title" : "Dewey defeats Truman"
	},
	{
		"id" : 2,
		"title" : "Man walks on Moon"
	}
] );
writeOutput( news.keyExists( "title" ) );

Result: true

Additional Examples

Run Example

myQuery = queryNew( "custID,custName" );
writeDump( queryKeyExists( myQuery, "age" ) );
writeDump( queryKeyExists( myQuery, "custName" ) );

Last updated

Was this helpful?