Below is the example of using the OpenDim operation to open a repository dictionary. The request contains moniker of the object that is a dictionary and a pattern for extracting information about dictionary structure and elements. The response contains moniker of opened dictionary and information about the structure and elements in accordance with the specified pattern.
{ "OpenDim" : { "tObject" : { "id" : "S1!M!116" }, "tArg" : {
"openArgs" : "", "metaArg" : { "pattern" : { "obInst" : "false", "getDescr" : "true", "getAttrs" : "true" }, "elsArg" :
{ "pattern" : { "attributes" : "*", "getParentKey" : "true" } } } } } }
{ "OpenDimResult" : { "id" : { "id" : "S1!M!S!S3" }, "meta" : { "id" : {
"id" : "S1!M!S!S3" }, "data" : { "descr" : { "k" : "116", "id" : "DIM_1", "n" : "Dim_1", "vis" : "1",
"cls" : { "k" : "1025" } }, "attrs" : { "it" : [ {
"k" : "117", "id" : "NAME", "n" : "Name", "vis" : "1", "dt" : "1", "predefined" : "Name" }, { "k" : "118", "id" : "ID"
"n" : "Identifier", "vis" : "1", "dt" : "2", "uniqueIndex" : "INDEX1", "predefined" : "Ident" }, { "k" : "119", "id" : "ORDER", "n" : "Order"
"vis" : "1", "dt" : "2", "predefined" : "Order" }, { "k" : "122", "id" : "PARENT", "n" : "Parent", "vis" : "1", "dt" : "2"
}, { "k" : "177", "id" : "CODE", "n" : "Code", "vis" : "1", "dt" : "1" } ] }
}, "els" : { "els" : { "e" : [ { "n" : "Item 1", "a" :
{ "it" : [ "Item 1", "1", "1", "0", "A000123" ] }
"ea" : { "it" : [ { "@v" : "Item 1" }, { "@v" : "1" }
{ "@v" : "1" }, { "@v" : "0" }, { "@v" : "A000123" } ]
}, "k" : "1", "h" : "1", "o" : "0" }, { "n" : "Item 2", "a" : { "it" :
[ "Item 2", "2", "2", "1", "A000124" ] }, "ea" : { :
"it" : [ { "@v" : "Item 2" }, { "@v" : "2" }, { "@v" : "2"
}, { "@v" : "1" }, { "@v" : "A000124" } ] }, "k" : "2",
"h" : "1", "o" : "1", "p" : "1" }, { "n" : "Item 3", "a" : { "it" : [
"Item 3", "3", "3", "2", "A000125" ] }, "ea" : { "it"
[ { "@v" : "Item 3" }, { "@v" : "3" }, { "@v" : "3" }
{ "@v" : "2" }, { "@v" : "A000125" } ] }, "k" : "3", "h" : "0",
"o" : "2", "p" : "2" }, { "n" : "Item 4", "a" : { "it" : [ "Item 4"
"4", "4", "0", "A000126" ] }, "ea" : { "it" : [
{ "@v" : "Item 4" }, { "@v" : "4" }, { "@v" : "4" }, {
"@v" : "0" }, { "@v" : "A000126" } ] }, "k" : "4", "h" : "0", "o" : "0"
} ] }, "id" : { "id" : "S1!M!S!S3" } } } } }
The OpenDimensionEx function specified below opens the repository dictionary with data extraction about the structure and elements of the dictionary. The repository connection moniker and the dictionary identifier are sent as input parameters. Parameters for extracting information are determined in the function body. The example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example. The result of the operation is the result of the function.
public static OpenDimResult OpenDimensionEx(MbId mb, string id) { var somClient = new SomPortTypeClient(); //Proxy object for operation execution //Operation execution parameters var tOpen = new OpenDim() { tArg = new OpenDimArg() { metaArg = new GetDimMetadataArg() { elsArg = new GetDimElementsArg() {
pattern = new ElsPattern() { attributes = "*", getParentKey = true } }, pattern = new DmMetadataPattern() { getAttrs = true, getDescr = true,
obInst = false } }, openArgs = new DmOpenArgs() }, tObject = new OdId() { id = mb.id + "!" + FindObjectById(mb, id).k } }; //Open dictionary with extracting metadata var tResult = somClient.OpenDim(tOpen); return tResult; }
See also: