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 getting 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" : "First element",
"a" :
{
"it" :
[
"1",
"A000123"
]
},
"k" : "1",
"h" : "1",
"o" : "0"
},
{
"@hc" : "1",
"@l" : "1",
"n" : "Second element",
"a" :
{
"it" :
[
"2",
"A000124"
]
},
"k" : "2",
"h" : "1",
"o" : "1",
"p" : "1"
},
{
"@hc" : "0",
"@l" : "2",
"n" : "Third element",
"a" :
{
"it" :
[
"3",
"A000125"
]
},
"k" : "3",
"h" : "0",
"o" : "2",
"p" : "2"
},
{
"@hc" : "0",
"@l" : "0",
"n" : "Fourth element",
"a" :
{
"it" :
[
"4",
"A000126"
]
},
"k" : "4",
"h" : "0",
"o" : "0"
},
{
"@hc" : "0",
"@l" : "0",
"n" : "Fifth element",
"a" :
{
"it" :
[
"5",
"A000127"
]
},
"k" : "5",
"h" : "0",
"o" : "0"
}
]
},
"id" :
{
"id" : "S1!M!S!S1"
}
}
}
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()
{
//Pattern that will be used to get information
pattern = new ElsPattern()
{
attributes = attributes,
getHasChildren = true,
getLevel = true,
getParentKey = true,
attributeValuesOnly = true,
extendedAttributeValuesOnly = false
}
},
tDim = moniker
};
//Get information about dictionary elements
var result = somClient.GetDimElements(tElements);
return result;
}
See also: