Below is the example of using the SetWbkMd operation to transform series values. The request contains an instance of opened workbook, data change pattern, series transformation parameters, and the pattern for extracting changed data. The response contains description of workbook series.
{
"SetWbkMd" :
{
"tWbk" :
{
"id" : "S1!M!S!W10"
},
"tArg" :
{
"refresh" : "",
"pattern" :
{
"obInst" : "false",
"series" : "Change",
"seriesDisplayParams" : "true"
},
"meta" :
{
"series" :
{
"its" :
{
"it" :
[
{
"k" : "2",
"id" : "OBJ2",
"n" : "USA|A",
"vis" : "true",
"kind" : "Calculate",
"dependencies" : "",
"selectedUnit" : "",
"displayParams" :
{
"inversion" : "Diff",
"inversionLag" : "PrecidingYear", "previousInversionLag" : "3", "setDefault" : "false" }, "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!W10"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@isShortcut" : "0",
"@isLink" : "0",
"i" : "WBK_AD",
"n" : "Annual data",
"k" : "5505",
"c" : "2827",
"p" : "5471",
"h" : "0"
}
},
"dirty" : "1",
"windowsPosition" : "Vertical",
"hasPivot" : "0",
"hasLaner" : "1",
"series" :
{
"@count" : "3",
"its" :
{
"it" :
[
{
"k" : "2",
"id" : "OBJ2",
"n" : "USA|A",
"vis" : "1",
"kind" : "Calculate", "selectedUnit" : "", "tag" : "", "hasChildren" : "0", "index" : "0", "expanded" : "0", "level" : "Year", "childrenCount" : "0", "visibleChildrenCount" : "0", "flags" : "0"
},
{
"k" : "4",
"id" : "OBJ4",
"n" : "Canada|A",
"vis" : "1",
"kind" : "Calculate",
"selectedUnit" : "",
"tag" : "",
"hasChildren" : "0",
"index" : "1",
"expanded" : "0",
"level" : "Year",
"childrenCount" : "0",
"visibleChildrenCount" : "0",
"flags" : "0"
},
{
"k" : "6",
"id" : "OBJ6",
"n" : "Russia|A", "vis" : "1", "kind" : "Calculate", "selectedUnit" : "", "tag" : "", "hasChildren" : "0", "index" : "2", "expanded" : "0", "level" : "Year", "childrenCount" : "0",
"visibleChildrenCount" : "0", "flags" : "0" } ] }, "displayDataAs" : "CalculatedValues", "autoRecalc" : "1" } } } }
The SetWbkTransformSerie function applies a transformation to the values of the first series: instead of the source data the window shows rate of series values growth to the previous year with the lag of three. Input parameters:
wbkId. Opened workbook instance.
wbk. Description of opened workbook.
After execution the function returns data change result.
public static SetWbkMdResult SetWbkTransformSerie(WbkId wbkId, WbkMd wbk)
{
if (!wbk.hasLaner.Value) { return null; };
// Get the first series in workbook
LnSerie transfSerie = wbk.series.its.GetValue(0) as LnSerie;
// Set parameters of series value transformation
transfSerie.displayParams = new LnSerieDisplayParams();
LnSerieDisplayParams par = transfSerie.displayParams;
par.inversion = TsInversionType.Diff;
par.inversionLag = TsInversionLag.PrecidingYear;
par.previousInversionLag = 3;
par.setDefault = false;
// Set operation execution parameters
var tOp = new SetWbkMd
{ // Specify changed workbook
tWbk = wbkId,
tArg = new SetWbkMdArg()
{ // Set data change pattern
pattern = new WbkMdPattern()
{
obInst = false,
series = ListOperation.Change,
seriesDisplayParams = true
},// Set data change parameters
meta = new WbkMd()
{ // Set data transformation parameters
series = new LnSeries()
{
its = new LnSerie[]{transfSerie}
}
},
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:
SOAP