Getting Series Values

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.

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">
<GetWbkMd xmlns="http://www.fsight.ru/PP.SOM.Som">
<tWbk xmlns="">
  <id>S1!M!S!W8</id>
  </tWbk>
<tArg xmlns="">
<pattern>
  <obInst>true</obInst>
  <useGridAutoAdjust>true</useGridAutoAdjust>
<observationsTable>
  <cells>true</cells>
  <emptyCells>false</emptyCells>
  <getCellDate>false</getCellDate>
<attributes>
<it>
  <k>-1</k>
  <id>DL</id>
  </it>
  </attributes>
  <getCellText>true</getCellText>
  </observationsTable>
<cellsTable>
  <cells>true</cells>
  <emptyCells>false</emptyCells>
  <getCellDate>true</getCellDate>
  </cellsTable>
  </pattern>
  </tArg>
  </GetWbkMd>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<GetWbkMdResult 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">
<id xmlns="">
  <id>S1!M!S!W8</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="1" hf="0">
  <i>WBK_OBS</i>
  <n>Mixed data</n>
  <k>5624</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>
<observationsTable columnCount="54" rowCount="3">
<cells>
  <c v="1" dt="2" row="0" column="0" att="0" text="Annual" />
  <c v="1" dt="2" row="0" column="17" att="0" text="Annual" />
  <c v="1" dt="2" row="0" column="34" att="0" text="Annual" />
  <c v="1" dt="2" row="0" column="51" att="0" text="Annual" />
  </cells>
  </observationsTable>
<cellsTable columnCount="54" rowCount="3">
<cells>
  <c v="1.64712876" dt="3" row="0" column="0" date="2000-01-01" />
  <c v="1.57305128" dt="3" row="0" column="17" date="2001-01-01" />
  <c v="1.39197321" dt="3" row="0" column="34" date="2002-01-01" />
  <c v="1.12858684" dt="3" row="0" column="51" date="2003-01-01" />
  </cells>
  </cellsTable>
  </meta>
  </GetWbkMdResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

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

JSON response:

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

GetWbkMd: Operation