Overview
...
Array<XmlNode> $XmlRepository.QueryXml(xquery: string)
...
Array<XmlNodeArray<Xml> $XmlRepository.QueryXml(xquery: string, parameters: object, collection: string)
Arguments
...
...
Remarks
If query does not return any result than return value is empty array.
The examples below shows how to query the domain database. To see how to query a process database check the latterexamplesSee XML $Database page for further information about domain and process databases.
Example
Find all customers
...
Code Block | ||
---|---|---|
| ||
var results = $XmlRepository.Query('//Customer[Id=$id]', { id : $Xml.Evaluate('CustomerId') }); $Xml.InnerXml( 'Customers', results.join() ); |
Example
Querying process database
Code Block | ||
---|---|---|
| ||
var results = $XmlRepository.QueryXml('collection("49551ed3-6229-408a-aaaa-eb510463acad")//Customer[Id=$id]', {
id : $Xml.Evaluate('CustomerId')
});
$Xml.InnerXml( 'Customers', results[0].Evaluate('Id') ); |
Remarks
If query does not return any result than return value is empty array.
The examples below shows how to query the domain database. To see how to query a process database check the latterexamples.
Example
Find all customers
Code Block | ||
---|---|---|
| ||
var results = $XmlRepository.Query('//Customer');
$Xml.InnerXml( 'Customer', results.join() ); |
Example
Find customer by id
Code Block | ||
---|---|---|
| ||
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 | ||
---|---|---|
| ||
var results = $XmlRepository.QueryXml('collection("49551ed3-6229-408a-aaaa-eb510463acad")//Customer[Id=$id]', { id : $Xml.Evaluate('CustomerId') }); $Xml.InnerXml( 'Customers', results[0].Evaluate('Id') ); |
Examples
...
Code Block | ||
---|---|---|
| ||
var results = $XmlRepository.Query('//Customer');
$Xml.InnerXml( 'Customer', results.join() ); |
...
Code Block | ||
---|---|---|
| ||
var results = $XmlRepository.Query('//Customer[Id=$id]', {
id : $Xml.Evaluate('CustomerId')
});
$Xml.InnerXml( 'Customers', results.join() ); |
...
language | js |
---|
...
See Also
- $XmlRepository.Query
- XML+Database