QPR Knowledge Base 2017.1

QueryObjects

QueryObjects

Previous topic Next topic No directory for this topic  

QueryObjects

Previous topic Next topic Topic directory requires JavaScript Mail us feedback on this topic!  

Revision history:

Introduced in QPR 8.0

Last changed in QPR 2015.1

 

Performs a query and returns the results as a ResultSet object.

 

Synopsis:

 

ResultSet QueryObjects(string sessionId, string query, string criteria, string sortBy, string attributes, string options)

 

Return Value:

Result set of the query as a ResultSet object. If the set contains objects to which the user does not have rights to, only object ID is returned for those. While this function returns the same information as QueryObjectsAsXml, the information is contained in objects derived from the GenericElement superclass.

 

Supported classes and their properties are as follows:

 

ResultSet

Root object returned by the QueryObjects function call

 

ResultSet properties:

int TotalResultsReturned: Number of objects matching the query

GenericElement[] ChildElements: Array containing all the objects matching the query. Currently all the objects in this array are of type ResultObject

 

ResultObject

Container for all the attributes of a single result object.
 

ResultObject properties:

string Id: ID of the object

GenericElement[] ChildElements: Array containing all the values of the queried attributes. Currently all the objects in this array are of type Property

 

Property

Container for the value of a single attribute of a single result object.

 

Property properties:

string Name: Name of the attribute

string Value: Value of the attribute

string ValueType: XML type of attribute's value

ValueElement[] Attributes: Array containing additional information about the property

GenericElement[] ChildElements: Array containing additional information about more complex attribute values. Currently all the objects in this array are of type Element

 

Element

Generic container for miscellaneous named information
 

Element properties:

string Name: Name of the element

string Value: Value of the element

string ValueType: XML type of element's value

ValueElement[] Attributes: Array containing additional information about the element

GenericElement[] ChildElements: Array containing additional related sub-objects of the element

 

ValueElement
Simple name+value container
 
ValueElement Properties:

string Name: Name

string Value: Value

string ValueType: XML type of the value

GenericElement[] ChildElements: Array containing additional related sub-objects. Currently always empty

 

 

Parameters:

 

sessionId: String. ID of an authenticated session.

query: String. The actual query. See the Query Syntax section for syntax information.

criteria: String.

sortBy: String.

attributes: String. Comma-separated list of attributes that are included in the results.

options: String. Additional options for the query.

 

Example Procedure:

 

ServiceClient client = new ServiceClient("WSHttpBinding_IService");

string sessionId = client.Authenticate("qpr", "demo");

ResultSet result = client.QueryObjects(sessionId, "[SC.1].SubObjects", "", "", "", "");

client.LogOff(sessionId);

client.Close();