Below is the example of using the SetWbkMd operation to display additional columns that contain attribute values and to sort workbook data by series names. The request contains an instance of opened workbook, changed parameters of column displaying and data sorting, patterns for changing and extracting data. The response contains requested data.
{ "SetWbkMd" : { "tWbk" : { "id" : "S1!M!S!W4" }, "tArg" : {
"refresh" : "", "pattern" : { "obInst" : "true", "sorting" : "true", "columns" : "Add", "columnsFilter" : "" }, "meta" : {
"columns" : { "its" : { "it" : [ { "k" : "0", "type" : "Database", "readOnly" : "true",
"db" : { "text" : "Name" }, "customTitle" : "Data source" }, { "k" : "0", "type" : "Attribute", "readOnly" : "false",
"att" : { "namingFormat" : "", "att" : { "@hasMultipleValues" : "false", "k" : "5", "id" : "UNIT", "n" : "Unit", "vis" : "false"
"value" : "", "valuesObj" : { "@isShortcut" : "false", "@isLink" : "false", "i" : "UNITS", "n" : "Units", "k" : "174", "c" : "4354", "p" : "159"
"h" : "false" }, "dt" : "2", "predefined" : "true", "primary" : "false", "unitsObj" : { "@isShortcut" : "false", "@isLink" : "false", "i" : "UNITS",
"n" : "Units", "k" : "5483", "c" : "1033", "p" : "5472", "h" : "false" } } } } ]
}, "fullHints" : "false" }, "sorting" : { "header" : { "its" : { "it" :
[ { "@direction" : "Asc", "col" : { "k" : "0", "id" : "NAME" } } ]
} } } }, "metaGet" : { "obInst" : "true" } } } }
{ "SetWbkMdResult" : { "refresh" : "", "id" :
{ "id" : "S1!M!S!W4" }, "meta" : { "obInst" : { "obDesc" : { "@isShortcut" : "0",
"@isLink" : "0", "i" : "WBK_AD_COLUMNS", "n" : "Yearly data with additional. columns", "k" : "5528", "c" : "2827", "p" : "5471", "h" : "0" } }, "dirty" : "1",
"windowsPosition" : "Vertical", "hasPivot" : "0", "hasLaner" : "1", "series" : { "@count" : "3", "its" : "" } } } }
The SetWbkColumns function displays additional workbook columns and changes data sorting order. Input parameters:
wbk. Workbook instance.
att. Factor attribute of time series database, which values will be displayed in the workbook.
After execution the function returns data change result.
public static SetWbkMdResult SetWbkColumns(WbkId wbk, RubAtt att) {// Set operation execution parameters var tOp = new SetWbkMd { tWbk = wbk, tArg = new SetWbkMdArg { // Set data change pattern pattern = new WbkMdPattern { columns = ListOperation.Add, columnsFilter = new ListFilter(),
sorting = true }, // Set changeable data meta = new WbkMd() {// Set displayed columns columns = new LnColumns() { fullHints = false, its = new LnColumn[] {// Column displaying information about data source
new LnColumn() { readOnly = true, type = LnColumnType.Database, db = new LnColumnDatabase() { text = LnDatabaseColumnText.Name }, customTitle = "Data source" },// Column displaying specified attribute values
new LnColumn() { type = LnColumnType.Attribute, readOnly = false, att = new LnColumnAtt() { namingFormat = "", rubKey = null, att = att }
} } },// Set data sorting parameters sorting = new LnSorting() { header = new LnHeaderSorting() { its = new LnHeaderColSort[] {// Set sorting parameters by series names new LnHeaderColSort()
{ col = new ItEntity() {id = "NAME"}, direction = SortDirection.Asc, directionSpecified = true } } } } },
// Set changed data extraction and update pattern metaGet = new WbkMdPattern() { }, refresh = new EaxRefresh() { } } }; // Create proxy object for operation execution var somClient = new SomPortTypeClient(); // Execute operation SetWbkMdResult sRes = somClient.SetWbkMd(tOp); return sRes; }
The example of a data table showing additional columns named Country and Indicator that contain attribute values
See also: