Below is the example of using the ChangeDimSelection operation to apply an alternative hierarchy in the selection of the dictionary elements. The request contains moniker of opened dictionary instance and the alternative hierarchy identifier and also the parameters for changing the selection, according to which the selection is made after applying the alternative hierarchy. The response contains the summary information on the selected elements and the moniker of the new instance of the dictionary.
{ "ChangeDimSelection" : { "tDim" : { "id" : "S1!M!S!S1" }, "tArg" : { "newInstance" : "true", "setHierarchy" : { "id" : "SOURCE1"
}, "elSelectOp" : "Unknown", "elRelative" : "Unknown", "next" : { "elSelectOp" : "Select", "elRelative" : "All" } } } }
{ "ChangeDimSelectionResult" : { "id" : "S1!M!S!S6", "selectionInfo" : { "firstSelected" :
{ "n" : "Item 1", "a" : { "it" : [ "Item 1", "1", "1", "0",
"A000123" ] }, "ea" : { "it" : [ { "@v" : "Item 1" },
{ "@v" : "1" }, { "@v" : "1" }, { "@v" : "0" }, {
"@v" : "A000123" } ] }, "k" : "1", "h" : "0", "o" : "0" }, "lastSelected" : {
"n" : "Item 3", "a" : { "it" : [ "Item 3", "3", "3", "2", "A000125"
] }, "ea" : { "it" : [ { "@v" : "Item 3" }, {
"@v" : "3" }, { "@v" : "3" }, { "@v" : "2" }, { "@v" : "A000125"
} ] }, "k" : "3", "h" : "0", "o" : "0" }, "selectedCount" : "3" } } }
The specified ApplyHierarchy function selects dictionary elements after applying the alternative hierarchy. The dictionary instance moniker and the alternative hierarchy identifier are sent as input parameters. The element selection parameters used after applying the alternative hierarchy are specified in the function body. The result of the function is the result of the operation.
public static ChangeDimSelectionResult ApplyHierarchy(DmId moniker, string hierarchyId) { var somClient = new SomPortTypeClient(); //Proxy object for operation execution //Operation execution parameters var tSel = new ChangeDimSelection() { tArg = new DmSelectionArg() { newInstance = true, setHierarchy = new DmHierArg() { id = hierarchyId }, //After application of alternative hierarchy select all elements next = new DmSelectionArg() { elRelative = DmElRelative.All, elSelectOp = DmElSelectOp.Select } }, tDim = moniker }; //Application of alternative hierarchy and selection of elements var result = somClient.ChangeDimSelection(tSel); return result; }
See also: