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 extracting changed data. The response contains the series left in the workbook.
{ "SetWbkMd" : { "tWbk" : { "id" : "S1!M!S!W9" },
"tArg" : { "refresh" : "", "pattern" : { "obInst" : "false", "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", "series" : "Get", "seriesDependencies" : "false", "seriesDependents" : "false", "seriesAtts" : "false", "seriesPrimaryAttsForEmpty" : "false", "seriesDisplayParams" : "false" } } } }
{ "SetWbkMdResult" : { "refresh" : "", "id" : { "id" : "S1!M!S!W9" },
"meta" : { "obInst" : { "obDesc" : { "@isShortcut" : "0", "@isLink" : "0", "i" : "WBK_DEL", "n" : "Data by regions",
"k" : "5772", "c" : "2827", "p" : "5471", "h" : "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" } } } }
The SetWbkDelSerie function deletes the first series from the workbook. Input parameters:
wbkId. Opened workbook instance.
wbk. Description of opened workbook.
After execution the function returns data change result.
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 parameters of operation execution var tOp = new SetWbkMd { // Determine changeable workbook tWbk = wbkId, tArg = new SetWbkMdArg() { // Determine data change pattern pattern = new WbkMdPattern()
{ obInst = false, series = ListOperation.Remove },// Set data change parameters meta = new WbkMd() { // Set deleted series series = new LnSeries() { its = new LnSerie[]{delSserie} }
}, refresh = new EaxRefresh { }, // Set changed data extraction pattern metaGet = new WbkMdPattern { title = false, series = ListOperation.Get, seriesAtts = false, seriesPrimaryAttsForEmpty = false, seriesDependencies = false
seriesDependents = false, seriesDisplayParams = false } } }; // Create proxy object for operation execution var somClient = new SomPortTypeClient(); // Execute operation SetWbkMdResult sRes = somClient.SetWbkMd(tOp); return sRes; }
See also: