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 extracting information about elements. The parameters indicate that operation extracts summary information on selection, information on each element selection, and information on child elements' selection. In the response the information about elements selection is available 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.
{ "GetDimElements" : { "tDim" : { "id" : "S1!M!S!S2" },
"tArg" : { "pattern" : { "getSelectState" : "true", "getHasSelectedChildren" : "true" }, "selectionInfo" : "true" } } }
{ "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 half-year 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", "a" : { "it" :
[ "1", "2000-01-01", "2000", "YEARS:2000", "1" ] }, "ea" : {
"it" : [ { "@v" : "1" }, { "@v" : "2000-01-01" }, { "@v" : "2000"
}, { "@v" : "YEARS:2000" }, { "@v" : "1" } ] }, "k" : "YEARS:2000",
"h" : "0", "o" : "0" }, "lastSelected" : { "n" : "III quarter 2000", "a" : { "it" : [
"3", "2000-07-01", "III quarter 2000", "QUARTERS:3.2000", "6" ] }, "ea" : { "it" :
[ { "@v" : "3" }, { "@v" : "2000-07-01" }, { "@v" : "III quarter 2000" },
{ "@v" : "QUARTERS:3.2000" }, { "@v" : "6" } ] }, "k" : "QUARTERS:3.2000", "h" : "0",
"o" : "0" }, "selectedCount" : "6", "calendarPeriod" : { "active" : "1", "start" : "2000-01-01", "end" : "2000-07-01", "levels" : {
"it" : [ "Year", "HalfYear", "Quarter" ] } } } } }
The specified GetSelectionInfo function returns information about selection of elements. The dictionary instance moniker is sent as an input parameter. The pattern that specifies indicates whether to extract information about the selection is given in the function body. The result of the function is the result of the operation.
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 on selection of elements var result = somClient.GetDimElements(tElements); return result; }
See also: