Getting Values of Specified Attributes

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.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetDimElements xmlns="http://www.fsight.ru/PP.SOM.Som">
<tDim xmlns="">
  <id>S1!M!S!S1</id>
  </tDim>
<tArg xmlns="">
<pattern>
  <attributes>ID;CODE</attributes>
  <attributeValuesOnly>true</attributeValuesOnly>
  <extendedAttributeValuesOnly>false</extendedAttributeValuesOnly>
  <getParentKey>true</getParentKey>
  <getHasChildren>true</getHasChildren>
  <getLevel>true</getLevel>
  <getImageIndex>true</getImageIndex>
  </pattern>
  </tArg>
  </GetDimElements>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<GetDimElementsResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<els xmlns="">
<e hc="1" l="0">
  <n>Item 1</n>
<a>
  <it>1</it>
  <it>A000123</it>
  </a>
  <k>1</k>
  <h>1</h>
  <o>0</o>
  </e>
<e hc="1" l="1">
  <n>Item 2</n>
<a>
  <it>2</it>
  <it>A000124</it>
  </a>
  <k>2</k>
  <h>1</h>
  <o>1</o>
  <p>1</p>
  </e>
<e hc="0" l="2">
  <n>Item 3</n>
<a>
  <it>3</it>
  <it>A000125</it>
  </a>
  <k>3</k>
  <h>0</h>
  <o>2</o>
  <p>2</p>
  </e>
<e hc="0" l="0">
  <n>Item 4</n>
<a>
  <it>4</it>
  <it>A000126</it>
  </a>
  <k>4</k>
  <h>0</h>
  <o>0</o>
  </e>
<e hc="0" l="0">
  <n>Fifth element</n>
<a>
  <it>5</it>
  <it>A000127</it>
  </a>
  <k>5</k>
  <h>0</h>
  <o>0</o>
  </e>
  </els>
<id xmlns="">
  <id>S1!M!S!S1</id>
  </id>
  </GetDimElementsResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"GetDimElements" :
{
"tDim" :
{
"id" : "S1!M!S!S1"
},
"tArg" :
{
"pattern" :
{
"attributes" : "ID;CODE",
"attributeValuesOnly" : "true",
"extendedAttributeValuesOnly" : "false",
"getParentKey" : "true",
"getHasChildren" : "true",
"getLevel" : "true",
"getImageIndex" : "true"
}
}
}
}

JSON response:

{
"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:

GetDimElements: Operation