Opening Workbook and Changing Data Display Period

Below is the example of using the OpenWbk operation to open a workbook with setting data display period. The request contains the workbook instance and the period to be set. The response contains the moniker of opened workbook instance.

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">
<OpenWbk xmlns="http://www.fsight.ru/PP.SOM.Som">
<tOb xmlns="">
  <id>S1!M!5505</id>
  </tOb>
<tArg xmlns="">
<args>
  <openForEdit>true</openForEdit>
  </args>
<metaGet>
  <obInst>true</obInst>
  <useGridAutoAdjust>true</useGridAutoAdjust>
  <period>true</period>
  </metaGet>
<metaSet>
<pattern>
  <obInst>true</obInst>
  <useGridAutoAdjust>true</useGridAutoAdjust>
  <period>true</period>
  </pattern>
<meta>
<period>
  <start>1995-01-01</start>
  <end>2015-01-01</end>
  </period>
  </meta>
<metaGet>
  <obInst>true</obInst>
  <useGridAutoAdjust>true</useGridAutoAdjust>
  <period>true</period>
  </metaGet>
  </metaSet>
  </tArg>
  </OpenWbk>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<OpenWbkResult 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!W3</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="2" hf="0">
  <i>WBK_AD</i>
  <n>Annual data</n>
  <k>5505</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>0</dirty>
  <windowsPosition>Vertical</windowsPosition>
  <hasPivot>0</hasPivot>
  <hasLaner>1</hasLaner>
<series count="3">
  <its />
  </series>
<period>
  <start>1995-01-01</start>
  <end>2015-01-01</end>
  </period>
  </meta>
<metaSet xmlns="">
<id>
  <id>S1!M!S!W3</id>
  </id>
<meta>
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="2" hf="0">
  <i>WBK_AD</i>
  <n>Annual data</n>
  <k>5505</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>0</dirty>
  <windowsPosition>Vertical</windowsPosition>
  <hasPivot>0</hasPivot>
  <hasLaner>1</hasLaner>
<series count="3">
  <its />
  </series>
<period>
  <start>1995-01-01</start>
  <end>2015-01-01</end>
  </period>
  </meta>
  </metaSet>
  </OpenWbkResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"OpenWbk" :
{
"tOb" :
{
"id" : "S1!M!5505"
},
"tArg" :
{
"args" :
{
"openForEdit" : "true"
},
"metaGet" :
{
"obInst" : "true",
"useGridAutoAdjust" : "true",
"period" : "true"
},
"metaSet" :
{
"pattern" :
{
"obInst" : "true",
"useGridAutoAdjust" : "true",
"period" : "true"
},
"meta" :
{
"period" :
{
"start" : "1995-01-01",
"end" : "2015-01-01"
}
},
"metaGet" :
{
"obInst" : "true",
"useGridAutoAdjust" : "true",
"period" : "true"
}
}
}
}
}

JSON response:

{
"OpenWbkResult" :
{
"id" :
{
"id" : "S1!M!S!W3"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "2",
"@hf" : "0",
"i" : "WBK_AD",
"n" : "Annual data",
"k" : "5505",
"c" : "2827",
"p" : "5471",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "0",
"windowsPosition" : "Vertical",
"hasPivot" : "0",
"hasLaner" : "1",
"series" :
{
"@count" : "3",
"its" : ""
},
"period" :
{
"start" : "1995-01-01",
"end" : "2015-01-01"
}
},
"metaSet" :
{
"id" :
{
"id" : "S1!M!S!W3"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "2",
"@hf" : "0",
"i" : "WBK_AD",
"n" : "Annual data",
"k" : "5505",
"c" : "2827",
"p" : "5471",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "0",
"windowsPosition" : "Vertical",
"hasPivot" : "0",
"hasLaner" : "1",
"series" :
{
"@count" : "3",
"its" : ""
},
"period" :
{
"start" : "1995-01-01",
"end" : "2015-01-01"
}
}
}
}
}
public static OpenWbkResult OpenWbkForEdit(MbId mb, string wbkId)
{
var tWbk = new OpenWbk()
{ // Set operation execution parameters
tArg = new OpenWbkArg()
{// Specify that open workbook for edit
args = new WbkOpenArgs()
{
openForEdit = true
},// Set pattern for getting data
metaGet = new WbkMdPattern()
{
period = true
},// Set parameters for changing data
metaSet = new SetWbkMdArg()
{ // Set pattern for changing data
pattern = new WbkMdPattern()
{
period = true
},// Set data to be changed
meta = new WbkMd()
{// Set parameters for changing display period
period = new LnPeriod()
{
start = DateTime.Parse("01.01.1995"),
end = DateTime.Parse("01.01.2015")
}
},// Set pattern for getting changed data
metaGet = new WbkMdPattern()
{
period = true
}
}
},// Specify workbook, with which execute operation
tOb = new OdId() { id = mb.id + "!" + FindObjectById(mb, wbkId).k }
};
// Create proxy object for operation execution
var somClient = new SomPortTypeClient();
// Execute operation
var tResult = somClient.OpenWbk(tWbk);
Console.WriteLine("Workbook changed: " + tResult.id.id);
LnPeriod period = tResult.meta.period;
Console.WriteLine("Previous data display period:");
Console.WriteLine("".PadRight(3) + "- start: " + period.start.ToShortDateString());
Console.WriteLine("".PadRight(3) + "- end: " + period.end.ToShortDateString());
period = tResult.metaSet.meta.period;
Console.WriteLine("New data display period:");
Console.WriteLine("Previous data display period:");
Console.WriteLine("".PadRight(3) + "- start: " + period.start.ToShortDateString());
Console.WriteLine("".PadRight(3) + "- end: " + period.end.ToShortDateString());
return tResult;
}

See also:

OpenWbk: Operation