Below is the example of using the GetDimElements operation to get values of the specified attributes. The request contains moniker of opened dictionary instance and parameters for extracting information about elements. The list of attributes is specified in the parameters. The response contains the list of values of the specified attributes for all the dictionary elements.
{ "GetDimElements" : { "tDim" : { "id" : "S1!M!S!S1" }, "tArg" : { "pattern" : {
"attributes" : "ID;CODE", "attributeValuesOnly" : "true", "extendedAttributeValuesOnly" : "false", "getParentKey" : "true", "getHasChildren" : "true", "getLevel" : "true", "getImageIndex" : "true" } } } }
{ "GetDimElementsResult" : { "els" : { "e" : [ { "@hc" : "1", "@l" : "0",
"n" : "Item 1", "a" : { "it" : [ "1", "A000123" ] }, "k" : "1",
"h" : "1", "o" : "0" }, { "@hc" : "1", "@l" : "1", "n" : "Item 2", "a" : { "it" :
[ "2", "A000124" ] }, "k" : "2", "h" : "1", "o" : "1", "p" : "1" },
{ "@hc" : "0", "@l" : "2", "n" : "Item 3", "a" : { "it" : [ "3", "A000125"
] }, "k" : "3", "h" : "0", "o" : "2", "p" : "2" }, { "@hc" : "0", "@l" : "0",
"n" : "Item 4", "a" : { "it" : [ "4", "A000126" ] }, "k" : "4",
"h" : "0", "o" : "0" } ] }, "id" : { "id" : "S1!M!S!S1" } } }
The specified GetAttributesValue function returns values of the specified attributes for all dictionary elements. The dictionary instance moniker and the list of attributes are sent as input parameters. The pattern, according to which the information is extracted, is specified in the function body. The result of the function is the result of the operation.
public static GetDimElementsResult GetAttributesValue(DmId moniker, string attributes) { var somClient = new SomPortTypeClient(); //Proxy object for operation execution //Operation execution parameters var tElements = new GetDimElements() { tArg = new GetDimElementsArg() { //The pattern, according to which the information will be extracted pattern = new ElsPattern() { attributes = attributes, getHasChildren = true, getLevel = true, getParentKey = true, attributeValuesOnly = true, extendedAttributeValuesOnly = false } }, tDim = moniker }; //Get information on dictionary elements var result = somClient.GetDimElements(tElements); return result; }
See also: