Below is the example of using the OpenMs operation to open a modeling container. The request contains the container moniker and a pattern for getting data. The response contains the opened modeling container instance moniker and data about the container scenarios.
The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier section.
{
"OpenMs" :
{
"tOb" :
{
"id" : "GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!306480"
},
"tArg" :
{
"args" : "",
"metaGet" :
{
"obInst" : "false",
"all" : "false",
"scenarios" : "Get",
"period" : "false"
}
}
}
}
{
"OpenMsResult" :
{
"id" :
{
"id" : "GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!S!CKHMBBEMHGPMOFOAEFJLGEGOGHKBCBLNEIJJACPIMKMHIKJIC"
},
"meta" :
{
"scenarios" :
{
"nodes" :
{
"it" :
{
"@isFolder" : "0",
"k" : "306497",
"id" : "OBJ306497",
"n" : "Basic",
"vis" : "1",
"scenDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "2",
"@hf" : "0",
"i" : "OBJ306497",
"n" : "Basic",
"k" : "306497",
"c" : "5124",
"p" : "306485",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0"
},
"internalKey" : "306497"
}
}
}
},
"readOnly" : "0"
}
}
public static MsScenarioTree OpenMsMeta(MbId mb, string msId)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
// Set operation execution parameters
var tMsOp = new OpenMs()
{
tArg = new OpenMsArg()
{
// Set container opening parameters
args = new MsOpenArgs(),
// Set data getting pattern
metaGet = new MsMdPattern()
{
all = false,
obInst = false,
period = false,
scenarios = ListOperation.Get
}
},
// Create modeling container moniker
tOb = new OdId() { id = mb.id + "!" + FindObjectById(mb, msId).k }
};
// Open modeling container with metadata request
var result = somClient.OpenMs(tMsOp);
return result.meta.scenarios;
}
See also: