Displaying Additional Columns with Attribute Values

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.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetWbkMd xmlns="http://www.fsight.ru/PP.SOM.Som">
<tWbk xmlns="">
  <id>S1!M!S!W6</id>
  </tWbk>
<tArg xmlns="">
  <refresh />
<pattern>
  <obInst>true</obInst>
  <sorting>true</sorting>
  <useGridAutoAdjust>true</useGridAutoAdjust>
  <columns>Add</columns>
  <columnsFilter />
  </pattern>
<meta>
<columns>
<its>
<it>
  <k>0</k>
  <type>Database</type>
  <readOnly>true</readOnly>
<db>
  <text>Name</text>
  </db>
  <customTitle>Data source</customTitle>
  </it>
<it>
  <k>0</k>
  <type>Attribute</type>
  <readOnly>false</readOnly>
<att>
  <namingFormat />
<att hasMultipleValues="false">
  <k>5</k>
  <id>UNIT</id>
  <n>Unit</n>
  <vis>false</vis>
<valuesObj isShortcut="false" isLink="false" ds="" ver="0" hf="false">
  <i>UNITS_D</i>
  <n>Measurement units</n>
  <k>174</k>
  <c>3076</c>
  <p>159</p>
  <h>false</h>
  <hasPrv>false</hasPrv>
  <ic>false</ic>
  <trackElementDependents>false</trackElementDependents>
  </valuesObj>
  <dt>2</dt>
  <predefined>true</predefined>
  <nullable>true</nullable>
  <primary>false</primary>
<unitsObj isShortcut="false" isLink="false" ds="" ver="0" hf="false">
  <i>UNITS</i>
  <n>Units</n>
  <k>5483</k>
  <c>1033</c>
  <p>5472</p>
  <h>false</h>
  <hasPrv>false</hasPrv>
  <ic>false</ic>
  <trackElementDependents>false</trackElementDependents>
  </unitsObj>
  <defaultValue />
  <dataDomain>0</dataDomain>
  <isInHierarchyByDefault>false</isInHierarchyByDefault>
  <orderInHierarchyByDefault>0</orderInHierarchyByDefault>
<filterInHierarchyByDefault>
  <k>174</k>
  <id>UNITS_D</id>
  <n>Measurement units</n>
  <vis>true</vis>
  </filterInHierarchyByDefault>
  </att>
  </att>
  </it>
  </its>
  <fullHints>false</fullHints>
  </columns>
<sorting>
<header>
<its>
<it direction="Asc">
<col>
  <k>0</k>
  <id>NAME</id>
  </col>
  </it>
  </its>
  </header>
  </sorting>
  </meta>
<metaGet>
  <obInst>true</obInst>
  <useGridAutoAdjust>true</useGridAutoAdjust>
  </metaGet>
  </tArg>
  </SetWbkMd>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetWbkMdResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <refresh xmlns="" />
<id xmlns="">
  <id>S1!M!S!W6</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="1" hf="0">
  <i>WBK_AD_COLUMNS</i>
  <n>Annual data with additional columns</n>
  <k>5528</k>
  <c>2827</c>
  <p>5471</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <trackElementDependents>0</trackElementDependents>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>1</dirty>
  <windowsPosition>Vertical</windowsPosition>
  <hasPivot>0</hasPivot>
  <hasLaner>1</hasLaner>
<series count="3">
  <its />
  </series>
  </meta>
  </SetWbkMdResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"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"
}
}
}
}

JSON response:

{
"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:

SetWbkMd: Operation