Below is the example of using the ChangeDimSelection operation to change selection of the specified elements. The request contains moniker of opened dictionary instance, the list of the element keys and their selection parameters. The response contains summary information on the selected elements.
{
"ChangeDimSelection" :
{
"tDim" :
{
"id" : "S1!M!S!S1"
},
"tArg" :
{
"newInstance" : "true",
"elSelectOp" : "Select",
"elRelative" : "Current",
"elKeys" :
{
"it" :
[
{
"key" : "1"
},
{
"key" : "2"
},
{
"key" : "3"
}
]
}
}
}
}
{
"ChangeDimSelectionResult" :
{
"id" : "S1!M!S!S4",
"selectionInfo" :
{
"firstSelected" :
{
"n" : "First element",
"a" :
{
"it" :
[
"First element",
"1",
"1",
"0",
"A000123"
]
},
"ea" :
{
"it" :
[
{
"@v" : "First element"
},
{
"@v" : "1"
},
{
"@v" : "1"
},
{
"@v" : "0"
},
{
"@v" : "A000123"
}
]
},
"k" : "1",
"h" : "0",
"o" : "0"
},
"lastSelected" :
{
"n" : "Third element",
"a" :
{
"it" :
[
"Third element",
"3",
"3",
"2",
"A000125"
]
},
"ea" :
{
"it" :
[
{
"@v" : "Third element"
},
{
"@v" : "3"
},
{
"@v" : "3"
},
{
"@v" : "2"
},
{
"@v" : "A000125"
}
]
},
"k" : "3",
"h" : "0",
"o" : "2"
},
"selectedCount" : "3",
"schema" :
{
"k" : "4294967295",
"vis" : "1",
"applyOnlyOnce" : "0",
"onceApplied" : "0",
"applyOnRebuild" : "0"
}
}
}
}
public static ChangeDimSelectionResult ChangeSelection(DmId moniker, ElKey[] selectedElements)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSel = new ChangeDimSelection()
{
tArg = new ChangeDimSelectionArg()
{
newInstance = true,
elKeys = selectedElements,
elRelative = DmElRelative.Current,
elSelectOp = DmElSelectOp.Select
},
tDim = moniker
};
//Select specified elements
var result = somClient.ChangeDimSelection(tSel);
return result;
}
See also: