SCalc

You can use the Scalc function to create, in columns and rows, custom formulas that use standard mathematical operators. Use this value within a row or column definition or within a cell override definition. The specified calculations are performed on the application server. The following example subtracts column 2 from column 1:

Scalc(col(1)-col(2))

You can also use this value to create text within the form.

Syntax

SCalc(<expression> [<operator> <expression>])

Note:

You can include multiple pairs of [<operator> <expression>] in an SCalc calculation.

Parameter Description
operator

The mathematical operator for the calculation. These operators are supported:

+ - * /

expression

The values in the calculation. In addition to numeric values, you can include cell references, row references, column references, and various other types of items.

You can use these types of items in SCalc calculations:

  • References to dimension members. This example references the Account dimension members Purchases and OtherCosts: R6=SCalc(((A#Purchases)-(A#OtherCosts))*100)

  • Cell references, using the syntax Cell( rowIndex , columnIndex ). This example refers to the cell in the fourth row of the second column in the form: R1=SCalc(Cell(4,2))

  • Row references, using the syntax Row( rowIndex ). This example divides row 4 by row 2: R3=SCalc(Row(4)/Row(2))

    Note:

    For rows or columns that contain member lists, the calculation occurs on the total for the members of the list.

  • Column references, using the syntax Col( columnIndex ). This example adds column 1 and column 3: C4=SCalc(Col(1)+Col(3))

  • Nested formulas, using parentheses to nest.

  • Forward references to cells with SCalc calculations

    Note:

    SCalc calculations are not performed until the data is saved and the calculated results are not displayed on the form until the form is refreshed.

An SCalc row or column can reference another SCalc row or column in its calculation, however you cannot forward reference in a SCalc row or column for another Scalc row or column. For example, this SCalc forward reference is allowed:

C1=A#Sales
C2=A#COGS
C3=SCalc(Col(1)-Col(2))
C4=SCalc(Col(3)/Col(1)*100)