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