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.
{
"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"
}
}
}
}
{
"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: