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 getting data. The response contains requested data.
{
"SetWbkMd" :
{
"tWbk" :
{
"id" : "S1!M!S!W6"
},
"tArg" :
{
"refresh" : "",
"pattern" :
{
"obInst" : "true",
"sorting" : "true",
"useGridAutoAdjust" : "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" : "Measurement unit",
"vis" : "false",
"valuesObj" :
{
"@ds" : "",
"@isShortcut" : "false",
"@isLink" : "false",
"@ver" : "0",
"@hf" : "false",
"i" : "UNITS_D",
"n" : "Measurement units",
"k" : "174",
"c" : "3076",
"p" : "159",
"h" : "false",
"hasPrv" : "false",
"ic" : "false",
"trackElementDependents" : "false"
},
"dt" : "2",
"predefined" : "true",
"nullable" : "true",
"primary" : "false",
"unitsObj" :
{
"@ds" : "",
"@isShortcut" : "false",
"@isLink" : "false",
"@ver" : "0",
"@hf" : "false",
"i" : "UNITS",
"n" : "Measurement units",
"k" : "5483",
"c" : "1033",
"p" : "5472",
"h" : "false",
"hasPrv" : "false",
"ic" : "false",
"trackElementDependents" : "false"
},
"defaultValue" : "",
"dataDomain" : "0",
"isInHierarchyByDefault" : "false",
"orderInHierarchyByDefault" : "0",
"filterInHierarchyByDefault" :
{
"k" : "174",
"id" : "UNITS_D",
"n" : "Measurement units",
"vis" : "true"
}
}
}
}
]
},
"fullHints" : "false"
},
"sorting" :
{
"header" :
{
"its" :
{
"it" :
[
{
"@direction" : "Asc",
"col" :
{
"k" : "0",
"id" : "NAME"
}
}
]
}
}
}
},
"metaGet" :
{
"obInst" : "true",
"useGridAutoAdjust" : "true"
}
}
}
}
{
"SetWbkMdResult" :
{
"refresh" : "",
"id" :
{
"id" : "S1!M!S!W6"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "1",
"@hf" : "0",
"i" : "WBK_AD_COLUMNS",
"n" : "Annual data with additional columns",
"k" : "5528",
"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" : ""
}
}
}
}
public static SetWbkMdResult SetWbkColumns(WbkId wbk, RubAtt att)
{// Set operation execution parameters
var tOp = new SetWbkMd
{
tWbk = wbk,
tArg = new SetWbkMdArg
{ // Set pattern for changing data
pattern = new WbkMdPattern
{
columns = ListOperation.Add,
columnsFilter = new ListFilter(),
sorting = true
},
// Set data to be changed
meta = new WbkMd()
{// Set columns to be displayed
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 values of the specified attribute
new LnColumn()
{
type = LnColumnType.Attribute,
readOnly = false,
att = new LnColumnAtt()
{
namingFormat = "",
rubKey = null,
att = att
}
}
}
},// Set parameters for sorting data
sorting = new LnSorting()
{
header = new LnHeaderSorting()
{
its = new LnHeaderColSort[]
{// Set parameters for sorting by series names
new LnHeaderColSort()
{
col = new ItEntity()
{id = "NAME"},
direction = SortDirection.Asc,
directionSpecified = true
}
}
}
}
},
// Set pattern for getting and updating changed data
metaGet = new WbkMdPattern() { },
refresh = new EaxRefresh() { }
}
};
// Cerate proxy object for operation execution
var somClient = new SomPortTypeClient();
// Execute operation
var 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: