Gradual Change of Selection within One Operation

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.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ChangeDimSelection xmlns="http://www.fsight.ru/PP.SOM.Som">
<tDim xmlns="">
  <id>S1!M!S!S1</id>
  </tDim>
<tArg xmlns="">
  <newInstance>true</newInstance>
  <elSelectOp>Select</elSelectOp>
  <elRelative>All</elRelative>
<next>
  <elSelectOp>Deselect</elSelectOp>
  <elRelative>Children</elRelative>
<elKeys>
<it>
  <key>1</key>
  </it>
  </elKeys>
  </next>
  </tArg>
  </ChangeDimSelection>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ChangeDimSelectionResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <id xmlns="">S1!M!S!S7</id>
<selectionInfo xmlns="">
<firstSelected>
  <n>Item 1</n>
<a>
  <it>First element</it>
  <it>1</it>
  <it>1</it>
  <it>0</it>
  <it>A000123</it>
  </a>
<ea>
  <it v="First element" />
  <it v="1" />
  <it v="1" />
  <it v="0" />
  <it v="A000123" />
  </ea>
  <k>1</k>
  <h>0</h>
  <o>0</o>
  </firstSelected>
<lastSelected>
  <n>Fifth element</n>
<a>
  <it>Fifth element</it>
  <it>5</it>
  <it>5</it>
  <it>0</it>
  <it>A000127</it>
  </a>
<ea>
  <it v="Fifth element" />
  <it v="5" />
  <it v="5" />
  <it v="0" />
  <it v="A000127" />
  </ea>
  <k>5</k>
  <h>0</h>
  <o>0</o>
  </lastSelected>
  <selectedCount>4</selectedCount>
<schema>
  <k>4294967295</k>
  <vis>1</vis>
  <applyOnlyOnce>0</applyOnlyOnce>
  <onceApplied>0</onceApplied>
  <applyOnRebuild>0</applyOnRebuild>
  </schema>
  </selectionInfo>
  </ChangeDimSelectionResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"ChangeDimSelection" :
{
"tDim" :
{
"id" : "S1!M!S!S1"
},
"tArg" :
{
"newInstance" : "true",
"elSelectOp" : "Select",
"elRelative" : "All",
"next" :
{
"elSelectOp" : "Deselect",
"elRelative" : "Children",
"elKeys" :
{
"it" :
{
"key" : "1"
}
}
}
}
}
}

JSON response:

{
"ChangeDimSelectionResult" :
{
"id" : "S1!M!S!S7",
"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" : "4",
"schema" :
{
"k" : "4294967295",
"vis" : "1",
"applyOnlyOnce" : "0",
"onceApplied" : "0",
"applyOnRebuild" : "0"
}
}
}
}
public static ChangeDimSelectionResult ChangeSelectionWithNext(DmId moniker)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSel = new ChangeDimSelection()
{
tArg = new ChangeDimSelectionArg()
{
//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:

ChangeDimSelection: Operation