Below is the example of using the ChangeDimSelection operation to select elements of the specified level. The request contains moniker of opened dictionary instance and identifier of the level that contains the elements to be selected. The response contains summary information about the selected elements.
In the C# example level identifier and moniker are sent as input parameters of the function.
{
"ChangeDimSelection" :
{
"tDim" :
{
"id" : "S1!M!S!S1"
},
"tArg" :
{
"newInstance" : "true",
"elSelectOp" : "Unknown",
"elRelative" : "Unknown",
"setLevel" :
{
"k" : "18446744073709551615",
"id" : "LEVEL1",
"selectOp" : "Select"
}
}
}
}
{
"ChangeDimSelectionResult" :
{
"id" : "S1!M!S!S8",
"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" : "Fifth element",
"a" :
{
"it" :
[
"Fifth element",
"5",
"5",
"0",
"A000127"
]
},
"ea" :
{
"it" :
[
{
"@v" : "Fifth element"
},
{
"@v" : "5"
},
{
"@v" : "5"
},
{
"@v" : "0"
},
{
"@v" : "A000127"
}
]
},
"k" : "5",
"h" : "0",
"o" : "0"
},
"selectedCount" : "3",
"schema" :
{
"k" : "4294967295",
"vis" : "1",
"applyOnlyOnce" : "0",
"onceApplied" : "0",
"applyOnRebuild" : "0"
}
}
}
}
public static ChangeDimSelectionResult SelectLevel(DmId moniker, string lvlId)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSel = new ChangeDimSelection()
{
tArg = new ChangeDimSelectionArg()
{
newInstance = true,
elSelectOp = DmElSelectOp.Unknown,
elRelative = DmElRelative.Unknown,
setLevel = new DmSelectLevelArg() { id = lvlId, k = uint.MaxValue, selectOp = DmElSelectOp.Select },
},
tDim = moniker
};
//Apply alternative hierarchy and select elements
var result = somClient.ChangeDimSelection(tSel);
return result;
}
See also: