TabFormulaResult CalculateFormula(TabSheetId tTabSheet, CalculateFormulaArgs tArg)
tTabSheet. Table moniker.
tArg. Operation execution parameters.
The CalculateFormula operation calculates formula intermediate value.
The operation allows for getting intermediate value of the formula part or entire formula specified in a table cell. To execute the operation, in the tTabSheet field specify table moniker, and in the tArg.coord field specify cell coordinates with the entire formula, and in the tArg.formula field specify the formula part, for which one should get intermediate value. The moniker can be based on the moniker of opened object instance, the table of which is worked with, following the rules:
'Express report instance moniker'!Tab. Express report table (if express report has one sheet).
'Express report instance moniker'!Sheets!'Sheet key'!Tab. table of specified express report sheet (if express report has several sheets).
'Workbook instance moniker'!Tab. Workbook table (if workbook has one sheet).
'Workbook instance moniker'!Sheets!'Sheet key'!Tab. Table of specified workbook sheet (if workbook has several sheets).
'Workbook instance moniker'!CorrTab. Table with correlation matrix.
'Workbook instance moniker'!CoeffTab. Table with equation coefficients.
'Workbook instance moniker'!WeightsTab. Table with weight matrix.
'Regular report instance moniker'!Sheet key. Table of specified regular report sheet.
The operation results in the calculated formula intermediate value formula.
Below is the example of calculating intermediate value of the formula part stored in a cell. The request contains table moniker. Cell coordinates with the formula and the formula part, for which one should calculate intermediate value. The response contains the calculated value.
{
"CalculateFormula" :
{
"tTabSheet" :
{
"id" : "HMDIIGPEOICFGOAEIIBIJLBDNGDMPMJELIMFOFPJFGIMCDLL!M!S!PLCLHEHPEOICFGOAEEIHIMLBLEJPGMEKEIKBLBOPFDDLPIDKF!Sheets!1"
},
"tArg" :
{
"formula" : "B0+C0",
"coord" :
{
"@T" : "0",
"@L" : "5"
}
}
}
}
{
"CalculateFormulaResult" :
{
"vt" : "3",
"v" : "5",
"err" : "0"
}
}
public static TabFormulaResult CalculateFormula(string moniker, string sheetKey, TabCoord cellCoord, string subFormula)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tCalc = new CalculateFormula()
{
tArg = new CalculateFormulaArgs()
{
coord = cellCoord,
formula = subFormula
},
tTabSheet = new TabSheetId() { id = moniker + "!Sheets!" + sheetKey }
};
// Calculate formula intermediate value
var result = somClient.CalculateFormula(tCalc);
return result;
}
See also: