Below is the example of using the ChangeDimSelection operation to change elements selection. The request contains moniker of opened dictionary instance and two sets of parameters, according to which the selection is changed. First, all the elements are selected, then the child elements of the element with the 1 key are deselected. The response contains summary information about the selected elements and the moniker of the new instance of the dictionary.
{ "ChangeDimSelection" : { "tDim" : { "id" : "S1!M!S!S1"
}, "tArg" : { "newInstance" : "true", "elSelectOp" : "Select", "elRelative" : "All", "next" : { "elSelectOp" : "Deselect", "elRelative" : "Children",
"elKeys" : { "it" : { "key" : "1" } } } } } }
{ "ChangeDimSelectionResult" : { "id" : "S1!M!S!S7", "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 4", "a" : { "it" : [ "Item 4", "4", "4", "0", "A000126"
] }, "ea" : { "it" : [ { "@v" : "Item 4" }, {
"@v" : "4" }, { "@v" : "4" }, { "@v" : "0" }, { "@v" : "A000126"
} ] }, "k" : "4", "h" : "0", "o" : "0" }, "selectedCount" : "3" } } }
The specified ChangeSelectionWithNext function selects the dictionary elements using its gradual change within one operation. The change stages are set up in the function body. The dictionary instance moniker is sent as an input parameter. The result of the function is the result of the operation.
public static ChangeDimSelectionResult ChangeSelectionWithNext(DmId moniker) { var somClient = new SomPortTypeClient(); //Proxy object for operation execution //Operation execution parameters var tSel = new ChangeDimSelection() { tArg = new DmSelectionArg() { //Stage 1. Select all elements newInstance = true, elRelative = DmElRelative.All, elSelectOp = DmElSelectOp.Select, //Stage 2. Deselect child elements of the specified element next = new DmSelectionArg() { elKeys = new ElKey[1] { new ElKey() { key = "1"} }, elRelative = DmElRelative.Children, elSelectOp = DmElSelectOp.Deselect } }, tDim = moniker }; //Change selection var result = somClient.ChangeDimSelection(tSel); return result; },
See also: