Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Performs an xquery on repository and returns the results as xml node array.

Array<Xml> $XmlRepository.QueryXml(xquery: string, parameters: object)

Arguments

string xquery
Specifies the query to perform on the database. The syntax of the query is quite detailed. More information can be found xquery standard page.
object parameters
Specifies the binding parameters on xquery string.

Remarks

If query does not return any result than return value is empty array.

See XML $Database page for further information about domain and process databases.

Example

Find all customers

Code Block
languagejs
var results = $XmlRepository.Query('//Customer');
$Xml.InnerXml( 'Customer', results.join() );

Example

Find customer by id

Code Block
languagejs
var results = $XmlRepository.Query('//Customer[Id=$id]', {
   id : $Xml.Evaluate('CustomerId')
 });
$Xml.InnerXml( 'Customers', results.join() );
Info

If you want to query the database of a process, you can use the collection keyword. You have to give the name of the database which is a GUID. For process databases, you can have that GUID by $Instance.ProcessId.

Example

Querying process database

Code Block
languagejs
var results = $XmlRepository.QueryXml('collection("49551ed3-6229-408a-aaaa-eb510463acad")//Customer[Id=$id]', {
id : $Xml.Evaluate('CustomerId')
});
$Xml.InnerXml( 'Customers', results[0].Evaluate('Id') );