Complementing Selection with Elements of Another Selection

Below is the example of using the ChangeDimSelection operation to complement selection of a dictionary instance with selection of another dictionary. The request contains moniker of the initial dictionary, which selection must be changed, and moniker of the source dictionary, which selection must be added. The response contains summary information about selected elements obtained after combining two selections.

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!S4</id>
  </tDim>
<tArg xmlns="">
  <elSelectOp>Unknown</elSelectOp>
  <elRelative>Unknown</elRelative>
<assign>
<source xsi:type="q1:ChangeDimSelectionResult" xmlns:q1="http://www.fsight.ru/PP.SOM.Som">
  <id>S1!M!S!S5</id>
<selectionInfo>
<firstSelected>
  <n>Item 2</n>
<a>
  <it>Second element</it>
  <it>2</it>
  <it>2</it>
  <it>1</it>
  <it>A000124</it>
  </a>
<ea>
  <it v="Second element" />
  <it v="2" />
  <it v="2" />
  <it v="1" />
  <it v="A000124" />
  </ea>
  <k>2</k>
  <h>false</h>
  <o>1</o>
  </firstSelected>
<lastSelected>
  <n>Item 3</n>
<a>
  <it>Third element</it>
  <it>3</it>
  <it>3</it>
  <it>2</it>
  <it>A000125</it>
  </a>
<ea>
  <it v="Third element" />
  <it v="3" />
  <it v="3" />
  <it v="2" />
  <it v="A000125" />
  </ea>
  <k>3</k>
  <h>false</h>
  <o>2</o>
  </lastSelected>
  <selectedCount>2</selectedCount>
<schema>
  <k>4294967295</k>
  <vis>true</vis>
  <applyOnlyOnce>false</applyOnlyOnce>
  <onceApplied>false</onceApplied>
  <applyImmediate>true</applyImmediate>
  <applyOnRebuild>false</applyOnRebuild>
  </schema>
<group>
  <k>157</k>
  <id>GROUP1</id>
  <n>Group of elements (according to list)</n>
  <vis>true</vis>
  </group>
  </selectionInfo>
  </source>
  <append>true</append>
  <keepGroup>true</keepGroup>
  <keepSchema>true</keepSchema>
  </assign>
  </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!S4</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>Item 3</n>
<a>
  <it>Third element</it>
  <it>3</it>
  <it>3</it>
  <it>2</it>
  <it>A000125</it>
  </a>
<ea>
  <it v="Third element" />
  <it v="3" />
  <it v="3" />
  <it v="2" />
  <it v="A000125" />
  </ea>
  <k>3</k>
  <h>0</h>
  <o>2</o>
  </lastSelected>
  <selectedCount>3</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!S4"
},
"tArg" :
{
"elSelectOp" : "Unknown",
"elRelative" : "Unknown",
"assign" :
{
"source" :
{
"@type" : "q1:ChangeDimSelectionResult",
"id" : "S1!M!S!S5",
"selectionInfo" :
{
"firstSelected" :
{
"n" : "Second element",
"a" :
{
"it" :
[
"Second element",
"2",
"2",
"1",
"A000124"
]
},
"ea" :
{
"it" :
[
{
"@v" : "Second element"
},
{
"@v" : "2"
},
{
"@v" : "2"
},
{
"@v" : "1"
},
{
"@v" : "A000124"
}
]
},
"k" : "2",
"h" : "false",
"o" : "1"
},
"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" : "false",
"o" : "2"
},
"selectedCount" : "2",
"schema" :
{
"k" : "4294967295",
"vis" : "true",
"applyOnlyOnce" : "false",
"onceApplied" : "false",
"applyImmediate" : "true",
"applyOnRebuild" : "false"
},
"group" :
{
"k" : "157",
"id" : "GROUP1",
"n" : "Group of elements (according to list)",
"vis" : "true"
}
}
},
"append" : "true",
"keepGroup" : "true",
"keepSchema" : "true"
}
}
}
}

JSON response:

{
"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 AppendSelection(string moniker, DmId source)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSel = new ChangeDimSelection()
{
tArg = new ChangeDimSelectionArg()
{
assign = new DmSelectionAssignArg()
{
append = true,
keepGroup = true,
keepSchema = true,
source = source
}
},
tDim = new DmId() { id = moniker }
};
//Change selection
var result = somClient.ChangeDimSelection(tSel);
return result;
}

See also:

ChangeDimSelection