Below is the example of using the GetWbkMd operation to get values for workbook series. The request contains an instance of opened workbook and patterns for getting workbook data. The response contains requested data.
{
"GetWbkMd" :
{
"tWbk" :
{
"id" : "S1!M!S!W8"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"useGridAutoAdjust" : "true",
"observationsTable" :
{
"cells" : "true",
"emptyCells" : "false",
"getCellDate" : "false",
"attributes" :
{
"it" :
{
"k" : "-1",
"id" : "DL"
}
},
"getCellText" : "true"
},
"cellsTable" :
{
"cells" : "true",
"emptyCells" : "false",
"getCellDate" : "true"
}
}
}
}
}
{
"GetWbkMdResult" :
{
"id" :
{
"id" : "S1!M!S!W8"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "1",
"@hf" : "0",
"i" : "WBK_OBS",
"n" : "Mixed data",
"k" : "5624",
"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" : "3",
"its" : ""
},
"observationsTable" :
{
"@rowCount" : "3",
"@columnCount" : "54",
"cells" :
{
"c" :
[
{
"@text" : "Annual",
"@v" : "1",
"@dt" : "2",
"@row" : "0",
"@att" : "0",
"@column" : "0"
},
{
"@text" : "Annual",
"@v" : "1",
"@dt" : "2",
"@row" : "0",
"@att" : "0",
"@column" : "17"
},
{
"@text" : "Annual",
"@v" : "1",
"@dt" : "2",
"@row" : "0",
"@att" : "0",
"@column" : "34"
},
{
"@text" : "Annual",
"@v" : "1",
"@dt" : "2",
"@row" : "0",
"@att" : "0",
"@column" : "51"
}
]
}
},
"cellsTable" :
{
"@rowCount" : "3",
"@columnCount" : "54",
"cells" :
{
"c" :
[
{
"@v" : "1.64712876",
"@dt" : "3",
"@row" : "0",
"@column" : "0",
"@date" : "2000-01-01"
},
{
"@v" : "1.57305128",
"@dt" : "3",
"@row" : "0",
"@column" : "17",
"@date" : "2001-01-01"
},
{
"@v" : "1.39197321",
"@dt" : "3",
"@row" : "0",
"@column" : "34",
"@date" : "2002-01-01"
},
{
"@v" : "1.12858684",
"@dt" : "3",
"@row" : "0",
"@column" : "51",
"@date" : "2003-01-01"
}
]
}
}
}
}
}
public static GetWbkMdResult GetWbkObsTbl(WbkId wbk)
{// Set operation execution parameters
var tOp = new GetWbkMd
{
tWbk = wbk,
tArg = new GetWbkMdArg
{// Set pattern for getting data
pattern = new WbkMdPattern
{
observationsTable = new WbkObservationsTablePattern()
{
getCellDate = false,
getCellText = true,
attributes = new ItKey[]
{
new ItKey()
{
id = "DL",
k = uint.MaxValue
}
},
cells = true,
emptyCells = false,
},
cellsTable = new WbkCellsTablePattern()
{
getCellDate = true,
cells = true,
emptyCells = false
}
}
}
};
// Create a proxy object for operation execution
var somClient = new SomPortTypeClient();
// Execute operation
var gRes = somClient.GetWbkMd(tOp);
// Display data table values in the window
ulong row = 10;
WbkCellsTable tbl = gRes.meta.cellsTable;
WbkObservationsTable obsTbl = gRes.meta.observationsTable;
foreach (PvtTableCell cell in tbl.cells)
{
if (row != cell.row)
{
row = cell.row; Console.WriteLine("---------ROW " + (row+1) + "---------");
PvtTableCell c = obsTbl.cells.Single(it = it.row == cell.row && it.column == cell.column);
Console.WriteLine("frequency: " + c.text);
Console.WriteLine("values:");
};
Console.Write(cell.date.ToShortDateString() + ": ");
Console.WriteLine(cell.v);
};
return gRes;
}
See also: