Getting Information about Element Selection

Below is the example of using the GetDimElements operation to get information about selection of elements. The request contains moniker of opened dictionary instance and parameters for getting information about elements. The parameters indicate that operation gets summary information on selection, information on each element selection, and information on child elements' selection. The response contains the information about elements selection in the els collection in the s and hs fields of each element. The summary information on the selection is available in the selectionInfo field.

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!S2</id>
  </tDim>
<tArg xmlns="">
<pattern>
  <getSelectState>true</getSelectState>
  <getHasSelectedChildren>true</getHasSelectedChildren>
  <getImageIndex>true</getImageIndex>
  </pattern>
  <selectionInfo>true</selectionInfo>
  </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 hs="1">
  <n>2000</n>
  <k>YEARS:2000</k>
  <h>1</h>
  <o>0</o>
  <s>1</s>
  </e>
<e hs="1">
  <n>I half-year 2000</n>
  <k>HALF_YEARS:1.2000</k>
  <h>1</h>
  <o>1</o>
  <s>1</s>
  </e>
<e hs="0">
  <n>I quarter 2000</n>
  <k>QUARTERS:1.2000</k>
  <h>0</h>
  <o>2</o>
  <s>1</s>
  </e>
<e hs="0">
  <n>II quarter 2000</n>
  <k>QUARTERS:2.2000</k>
  <h>0</h>
  <o>2</o>
  <s>1</s>
  </e>
<e hs="1">
  <n>II half-year 2000</n>
  <k>HALF_YEARS:2.2000</k>
  <h>1</h>
  <o>1</o>
  <s>1</s>
  </e>
<e hs="0">
  <n>III quarter 2000</n>
  <k>QUARTERS:3.2000</k>
  <h>0</h>
  <o>2</o>
  <s>1</s>
  </e>
<e hs="0">
  <n>IV quarter 2000</n>
  <k>QUARTERS:4.2000</k>
  <h>0</h>
  <o>2</o>
  <s>0</s>
  </e>
<e hs="0">
  <n>2001</n>
  <k>YEARS:2001</k>
  <h>1</h>
  <o>0</o>
  <s>0</s>
  </e>
<e hs="0">
  <n>I half-year 2001</n>
  <k>HALF_YEARS:1.2001</k>
  <h>1</h>
  <o>1</o>
  <s>0</s>
  </e>
<e hs="0">
  <n>I quarter 2001</n>
  <k>QUARTERS:1.2001</k>
  <h>0</h>
  <o>2</o>
  <s>0</s>
  </e>
<e hs="0">
  <n>II quarter 2001</n>
  <k>QUARTERS:2.2001</k>
  <h>0</h>
  <o>2</o>
  <s>0</s>
  </e>
<e hs="0">
  <n>II half-year 2001</n>
  <k>HALF_YEARS:2.2001</k>
  <h>1</h>
  <o>1</o>
  <s>0</s>
  </e>
<e hs="0">
  <n>III quarter 2001</n>
  <k>QUARTERS:3.2001</k>
  <h>0</h>
  <o>2</o>
  <s>0</s>
  </e>
<e hs="0">
  <n>IV quarter 2001</n>
  <k>QUARTERS:4.2001</k>
  <h>0</h>
  <o>2</o>
  <s>0</s>
  </e>
  </els>
<id xmlns="">
  <id>S1!M!S!S2</id>
  </id>
<selectionInfo xmlns="">
<firstSelected>
  <n>2000</n>
  <k>YEARS:2000</k>
  <h>0</h>
  <o>0</o>
  </firstSelected>
<lastSelected>
  <n>III quarter 2000</n>
  <k>QUARTERS:3.2000</k>
  <h>0</h>
  <o>2</o>
  </lastSelected>
  <selectedCount>6</selectedCount>
<calendarPeriod>
  <active>1</active>
  <start>2000-01-01</start>
  <end>2000-07-01</end>
<levels>
  <it>Year</it>
  <it>HalfYear</it>
  <it>Quarter</it>
  </levels>
  </calendarPeriod>
<schema>
  <k>4294967295</k>
  <vis>1</vis>
  <applyOnlyOnce>0</applyOnlyOnce>
  <onceApplied>0</onceApplied>
  <applyOnRebuild>0</applyOnRebuild>
  </schema>
  </selectionInfo>
  </GetDimElementsResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"GetDimElements" :
{
"tDim" :
{
"id" : "S1!M!S!S2"
},
"tArg" :
{
"pattern" :
{
"getSelectState" : "true",
"getHasSelectedChildren" : "true",
"getImageIndex" : "true"
},
"selectionInfo" : "true"
}
}
}

JSON response:

{
"GetDimElementsResult" :
{
"els" :
{
"e" :
[
{
"@hs" : "1",
"n" : "2000",
"k" : "YEARS:2000",
"h" : "1",
"o" : "0",
"s" : "1"
},
{
"@hs" : "1",
"n" : "I half-year 2000",
"k" : "HALF_YEARS:1.2000",
"h" : "1",
"o" : "1",
"s" : "1"
},
{
"@hs" : "0",
"n" : "I quarter 2000",
"k" : "QUARTERS:1.2000",
"h" : "0",
"o" : "2",
"s" : "1"
},
{
"@hs" : "0",
"n" : "II quarter 2000",
"k" : "QUARTERS:2.2000",
"h" : "0",
"o" : "2",
"s" : "1"
},
{
"@hs" : "1",
"n" : "II half-year 2000",
"k" : "HALF_YEARS:2.2000",
"h" : "1",
"o" : "1",
"s" : "1"
},
{
"@hs" : "0",
"n" : "III quarter 2000",
"k" : "QUARTERS:3.2000",
"h" : "0",
"o" : "2",
"s" : "1"
},
{
"@hs" : "0",
"n" : "IV quarter 2000",
"k" : "QUARTERS:4.2000",
"h" : "0",
"o" : "2",
"s" : "0"
},
{
"@hs" : "0",
"n" : "2001",
"k" : "YEARS:2001",
"h" : "1",
"o" : "0",
"s" : "0"
},
{
"@hs" : "0",
"n" : "I half-year 2001",
"k" : "HALF_YEARS:1.2001",
"h" : "1",
"o" : "1",
"s" : "0"
},
{
"@hs" : "0",
"n" : "I quarter 2001",
"k" : "QUARTERS:1.2001",
"h" : "0",
"o" : "2",
"s" : "0"
},
{
"@hs" : "0",
"n" : "II quarter 2001",
"k" : "QUARTERS:2.2001",
"h" : "0",
"o" : "2",
"s" : "0"
},
{
"@hs" : "0",
"n" : "II quarter 2001",
"k" : "HALF_YEARS:2.2001",
"h" : "1",
"o" : "1",
"s" : "0"
},
{
"@hs" : "0",
"n" : "III quarter 2001",
"k" : "QUARTERS:3.2001",
"h" : "0",
"o" : "2",
"s" : "0"
},
{
"@hs" : "0",
"n" : "IV quarter 2001",
"k" : "QUARTERS:4.2001",
"h" : "0",
"o" : "2",
"s" : "0"
}
]
},
"id" :
{
"id" : "S1!M!S!S2"
},
"selectionInfo" :
{
"firstSelected" :
{
"n" : "2000",
"k" : "YEARS:2000",
"h" : "0",
"o" : "0"
},
"lastSelected" :
{
"n" : "III quarter 2000",
"k" : "QUARTERS:3.2000",
"h" : "0",
"o" : "2"
},
"selectedCount" : "6",
"calendarPeriod" :
{
"active" : "1",
"start" : "2000-01-01",
"end" : "2000-07-01",
"levels" :
{
"it" :
[
"Year",
"HalfYear",
"Quarter"
]
}
},
"schema" :
{
"k" : "4294967295",
"vis" : "1",
"applyOnlyOnce" : "0",
"onceApplied" : "0",
"applyOnRebuild" : "0"
}
}
}
}
public static GetDimElementsResult GetSelectionInfo(DmId moniker)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tElements = new GetDimElements()
{
tArg = new GetDimElementsArg()
{
pattern = new ElsPattern()
{
getHasSelectedChildren = true,
getSelectState = true
},
selectionInfo = true
},
tDim = moniker
};
//Get information about element selection
var result = somClient.GetDimElements(tElements);
return result;
}

See also:

GetDimElements: Operation