OpenQuery

Syntax

QueryResult OpenQuery(OdId tOb, OpenQueryArg tArg)

Parameters

tOb. Moniker of repository object that is query.

tArg. Operation execution parameters.

Description

The OpenQuery operation opens the Query repository object and returns context of working with it.

Comments

The operation enables the user to get access to query structure and also to the data set obtained by this query. To execute the operation, in the tOb field specify moniker of the repository object that is query, and in the tArg field specify opening parameters. In the tArg.metaGet field specify parameters for getting metadata. The operation results in the moniker of opened query instance and also requested metadata if the appropriate pattern was specified in executing the operation. The further work with the opened query instance is executed using the GetQuery and SetQuery operations. To close the opened query instance, use the CloseQuery operation.

Example

The example of opening the Query object for edit. The request contains object moniker in the repository. The response contains moniker of opened instance of the Query object.

The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier section.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<OpenQuery xmlns="http://www.fsight.ru/PP.SOM.Som">
<tOb xmlns="">
  <id>S1!M!9051</id>
  </tOb>
<tArg xmlns="">
<args>
  <openForEdit>true</openForEdit>
  </args>
  </tArg>
  </OpenQuery>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<OpenQueryResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>S1!M!S!QUERY6</id>
  </id>
  </OpenQueryResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"OpenQuery" :
{
"tOb" :
{
"id" : "S1!M!9051"
},
"tArg" :
{
"args" :
{
"openForEdit" : "true"
}
}
}
}

JSON response:

{
"OpenQueryResult" :
{
"id" :
{
"id" : "S1!M!S!QUERY6"
}
}
}
public static QueryResult OpenQuery(MbId mb, string id)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tOpen = new OpenQuery()
{
tArg = new OpenQueryArg()
{
args = new QueryOpenArgs()
{
openForEdit = true
}
},
tOb = new OdId() { id = mb.id + "!" + FindObjectById(mb, id).k }
};
//Open query
var tResult = somClient.OpenQuery(tOpen);
return tResult;
}

See also:

Working with Relational Objects of Repository