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.
{
"GetDimElements" :
{
"tDim" :
{
"id" : "S1!M!S!S2"
},
"tArg" :
{
"pattern" :
{
"getSelectState" : "true",
"getHasSelectedChildren" : "true",
"getImageIndex" : "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 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: