Below is the example of using the OpenWbk operation to open a workbook and at the same time change data display period. The request contains a workbook instance, data change parameters, and patterns for getting the unchanged and changed data. The response contains the requested unchanged and changed data.
{ "OpenWbk" : { "tOb" : { "id" : "S1!M!5505" }, "tArg" : { "args" : {
"openForEdit" : "true" }, "metaGet" : { "obInst" : "true", "period" : "true" }, "metaSet" : { "pattern" :
{ "obInst" : "true", "period" : "true" }, "meta" : { "period" : { "start" : "1995-01-01", "end" : "2015-01-01"
} }, "metaGet" : { "obInst" : "true", "period" : "true" } } } } }
{ "OpenWbkResult" : { "id" : { "id" : "S1!M!S!W1" },
"meta" : { "obInst" : { "obDesc" : { "@isShortcut" : "0", "@isLink" : "0", "i" : "WBK_AD", "n" : "Yearly data",
"k" : "5505", "c" : "2827", "p" : "5471", "h" : "0" } }, "dirty" : "1", "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!W1" }, "meta" : { "obInst" :
{ "obDesc" : { "@isShortcut" : "0", "@isLink" : "0", "i" : "WBK_AD", "n" : "Yearly data", "k" : "5505", "c" : "2827", "p" : "5471",
"h" : "0" } }, "dirty" : "1", "windowsPosition" : "Vertical", "hasPivot" : "0", "hasLaner" : "1", "series" : { "@count" : "3",
"its" : "" }, "period" : { "start" : "1995-01-01", "end" : "2015-01-01" } } } } }
The OpenWbkForEdit function opens a workbook and changes borders of data display period. Input parameters:
mb. Repository connection moniker.
wbkId. Workbook identifier.
After executing the function returns the result of workbook opening. The console window displays borders of data display period before and after the change.
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 data extraction pattern metaGet = new WbkMdPattern()
{ period = true },// Set data change parameters metaSet = new SetWbkMdArg() { // Set data change pattern pattern = new WbkMdPattern() { period = true },// Set changeable data meta = new WbkMd()
{// Set display period change parameters period = new LnPeriod() { start = DateTime.Parse("01.01.1995"), end = DateTime.Parse("01.01.2015") } },// Set changed data extraction pattern 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 is changed: " + tResult.id.id);
LnPeriod period = tResult.meta.period; Console.WriteLine("Previous display data 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: