QueryResult OpenQuery(OdId tOb, OpenQueryArg tArg)
tOb. Moniker of repository object that is query.
tArg. Operation execution parameters.
The OpenQuery operation opens the Query repository object and returns context of working with it.
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.
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.
{
"OpenQuery" :
{
"tOb" :
{
"id" : "S1!M!9051"
},
"tArg" :
{
"args" :
{
"openForEdit" : "true"
}
}
}
}
{
"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: