CalculateFormula

Syntax

TabFormulaResult CalculateFormula(TabSheetId tTabSheet, CalculateFormulaArgs tArg)

Parameters

tTabSheet. Table moniker.

tArg. Operation execution parameters.

Description

The CalculateFormula operation calculates formula intermediate value.

Comments

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:

The operation results in the calculated formula intermediate value formula.

Example

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.

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">
<CalculateFormula xmlns="http://www.fsight.ru/PP.SOM.Som">
<tTabSheet xmlns="">
  <id>HMDIIGPEOICFGOAEIIBIJLBDNGDMPMJELIMFOFPJFGIMCDLL!M!S!PLCLHEHPEOICFGOAEEIHIMLBLEJPGMEKEIKBLBOPFDDLPIDKF!Sheets!1</id>
  </tTabSheet>
<tArg xmlns="">
  <formula>B0+C0</formula>
  <coord L="5" T="0" />
  </tArg>
  </CalculateFormula>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<CalculateFormulaResult 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">
  <vt xmlns="">3</vt>
  <v xmlns="">5</v>
  <err xmlns="">0</err>
  </CalculateFormulaResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"CalculateFormula" :
{
"tTabSheet" :
{
"id" : "HMDIIGPEOICFGOAEIIBIJLBDNGDMPMJELIMFOFPJFGIMCDLL!M!S!PLCLHEHPEOICFGOAEEIHIMLBLEJPGMEKEIKBLBOPFDDLPIDKF!Sheets!1"
},
"tArg" :
{
"formula" : "B0+C0",
"coord" :
{
"@T" : "0",
"@L" : "5"
}
}
}
}

JSON response:

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

Table: Operations