Deleting a Series from Workbook

Below is the example of using the SetWbkMd operation to delete a series from the workbook. The request contains an instance of opened workbook, data change pattern, the series to be deleted, and the pattern for getting changed data. The response contains the series left in the workbook.

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">
<SetWbkMd xmlns="http://www.fsight.ru/PP.SOM.Som">
<tWbk xmlns="">
  <id>S1!M!S!W11</id>
  </tWbk>
<tArg xmlns="">
  <refresh />
<pattern>
  <obInst>false</obInst>
  <useGridAutoAdjust>true</useGridAutoAdjust>
  <series>Remove</series>
  </pattern>
<meta>
<series>
<its>
<it>
  <k>6</k>
  <id>OBJ6</id>
  <n>Russia|A</n>
  <vis>true</vis>
  <kind>Calculate</kind>
  <dependencies />
  <selectedUnit />
  <tag />
  <hasChildren>false</hasChildren>
  <index>0</index>
  <expanded>false</expanded>
  <level>Year</level>
  <childrenCount>0</childrenCount>
  <visibleChildrenCount>0</visibleChildrenCount>
  <flags>0</flags>
  </it>
  </its>
  </series>
  </meta>
<metaGet>
  <obInst>true</obInst>
  <title>false</title>
  <useGridAutoAdjust>true</useGridAutoAdjust>
  <series>Get</series>
  <seriesDependencies>false</seriesDependencies>
  <seriesDependents>false</seriesDependents>
  <seriesAtts>false</seriesAtts>
  <seriesPrimaryAttsForEmpty>false</seriesPrimaryAttsForEmpty>
  <seriesDisplayParams>false</seriesDisplayParams>
  </metaGet>
  </tArg>
  </SetWbkMd>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetWbkMdResult 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">
  <refresh xmlns="" />
<id xmlns="">
  <id>S1!M!S!W11</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="1" hf="0">
  <i>WBK_DEL</i>
  <n>Data by regions</n>
  <k>5772</k>
  <c>2827</c>
  <p>5471</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <trackElementDependents>0</trackElementDependents>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>1</dirty>
  <windowsPosition>Vertical</windowsPosition>
  <hasPivot>0</hasPivot>
  <hasLaner>1</hasLaner>
<series count="1">
<its>
<it>
  <k>10</k>
  <id>OBJ10</id>
  <n>Geometric trend(France|A)</n>
  <vis>1</vis>
  <kind>Calculate</kind>
  <selectedUnit />
  <tag />
  <hasChildren>0</hasChildren>
  <index>0</index>
  <expanded>0</expanded>
  <level>Year</level>
  <childrenCount>0</childrenCount>
  <visibleChildrenCount>0</visibleChildrenCount>
  <flags>0</flags>
  </it>
  </its>
  <displayDataAs>CalculatedValues</displayDataAs>
  <autoRecalc>1</autoRecalc>
  <createDerivedSeries>Default</createDerivedSeries>
  <permanentData>0</permanentData>
  </series>
  </meta>
  </SetWbkMdResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"SetWbkMd" :
{
"tWbk" :
{
"id" : "S1!M!S!W11"
},
"tArg" :
{
"refresh" : "",
"pattern" :
{
"obInst" : "false",
"useGridAutoAdjust" : "true",
"series" : "Remove"
},
"meta" :
{
"series" :
{
"its" :
{
"it" :
[
{
"k" : "6",
"id" : "OBJ6",
"n" : "Russia|A",
"vis" : "true",
"kind" : "Calculate",
"dependencies" : "",
"selectedUnit" : "",
"tag" : "",
"hasChildren" : "false",
"index" : "0",
"expanded" : "false",
"level" : "Year",
"childrenCount" : "0",
"visibleChildrenCount" : "0",
"flags" : "0"
}
]
}
}
},
"metaGet" :
{
"obInst" : "true",
"title" : "false",
"useGridAutoAdjust" : "true",
"series" : "Get",
"seriesDependencies" : "false",
"seriesDependents" : "false",
"seriesAtts" : "false",
"seriesPrimaryAttsForEmpty" : "false",
"seriesDisplayParams" : "false"
}
}
}
}

JSON response:

{
"SetWbkMdResult" :
{
"refresh" : "",
"id" :
{
"id" : "S1!M!S!W11"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "1",
"@hf" : "0",
"i" : "WBK_DEL",
"n" : "Data by regions",
"k" : "5772",
"c" : "2827",
"p" : "5471",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "1",
"windowsPosition" : "Vertical",
"hasPivot" : "0",
"hasLaner" : "1",
"series" :
{
"@count" : "1",
"its" :
{
"it" :
[
{
"k" : "10",
"id" : "OBJ10",
"n" : "Geometric trend(France|A)",
"vis" : "1",
"kind" : "Calculate",
"selectedUnit" : "",
"tag" : "",
"hasChildren" : "0",
"index" : "0",
"expanded" : "0",
"level" : "Year",
"childrenCount" : "0",
"visibleChildrenCount" : "0",
"flags" : "0"
}
]
},
"displayDataAs" : "CalculatedValues",
"autoRecalc" : "1",
"createDerivedSeries" : "Default",
"permanentData" : "0"
}
}
}
}
public static SetWbkMdResult SetWbkDelSerie(WbkId wbkId, WbkMd wbk)
{
if (!wbk.hasLaner.Value){return null;};
// Get the first series in workbook
LnSerie delSserie = wbk.series.its.GetValue(0) as LnSerie;

// Set operation execution parameters
var tOp = new SetWbkMd
{ // Specify workbook to be changed
tWbk = wbkId,
tArg = new SetWbkMdArg()
{ // Set pattern for changing data
pattern = new WbkMdPattern()
{
obInst = false,
series = ListOperation.Remove
},// Set parameters for changing data
meta = new WbkMd()
{ // Set series to be deleted
series = new LnSeries()
{
its = new LnSerie[]{delSserie}
}
},
refresh = new EaxRefresh { },
// Set pattern for getting changed data
metaGet = new WbkMdPattern
{
title = false,
series = ListOperation.Get,
seriesAtts = false,
seriesPrimaryAttsForEmpty = false,
seriesDependencies = false,
seriesDependents = false,
seriesDisplayParams = false
}
}
};
// Create a proxy object for operation execution
var somClient = new SomPortTypeClient();
// Execute operation
var sRes = somClient.SetWbkMd(tOp);
return sRes;
}

See also:

SetWbkMd: Operation