Skip to Content

Calculation formula syntax

This article applies only to the PRO version of Staff.

The functions are used in the formulas for calculating the rate and amount of Salary types, as well as in the calculated columns of Settlements.

Formulas are essential for calculating different salaries, as well as for drawing up settlements. In its most elementary form, a formula can be a simple number. It can also be a mathematical expression, such as :

2*(3.55+17)

Writing a formula also requires the use of functions. Office Maker Staff functions can be used to manipulate values other than simple numerical constants.

Let's take the example of AHV/AVS. One of the values required to calculate the deduction is the amount subject to AHV/AVS, i.e. the total of all salary types subject to AHV/AVS. This set of salary types is accumulated in a Base, which bears the number 2 and is called "AHV-ALV/AVS-AC (Base)".

The formula for the "AHV/AVS Base" salary type amount (No. 5005.06 in the standard settings) can therefore be defined as "the value of Base number 2". The formula is written using the ValueBase function, which receives one parameter, which is of course the value 2.

ValueBase(2 "AHV-ALV/AVS-AC (Base)")
The program automatically follows parameter 2 with the base name.

Function parameters must be enclosed in brackets:

Function(parameter)

which in our example gives :

ValueBase(2)

You can type this formula directly with the keyboard. However, it's easier to click on the desired function from among those available. By clicking on the ValueBase function, a window appears requesting the function's parameter, i.e. the name of the Base whose value is required. In our example, click on "AHV-ALV/AVS-AC (Base)". In two clicks, you'll obtain the following formula:

ValueBase(2 "AHV-ALV/AVS-AC (Base)")

The name of the Base has been added by the program, for information only. Anything enclosed in quotation marks is not taken into account when evaluating the formula.

Some functions require several parameters; they must be separated by semicolons, using the following syntax:

Function(parameter1;parameter2;parameter3...)

Some parameters are optional. In the list of functions, they are then indicated between square brackets, in the form :

Function(parameter1;parameter2[;parameter3]...[;parameterN])

Let's take the case of the Unemployment Insurance salary type, whose amount must be the value of the Unemployment Base, but with a maximum Upper limit of 8,100 Frs per month.

In the list of functions, the Upper limit function is presented as follows:

Upper limit(upper limit nr; formula)

Type returned Number  
Context Rate, Amount or Total  
Parameters Type Description
upper limit nr Number Upper limit code number
formula Formula or number Upper limit value

The Upper limit function receives two parameters: the Upper limit number and the value to be set. It is perfectly possible to combine different functions within the same formula. The ValueBase function can therefore be used for the second parameter of the Upper limit function. This gives us the following formula:

Formula for the amount:

Upper limit(101 "Maximum of 8100";ValueBase(8 "Unemp. insur."))

You use a function to obtain a value. We also say that the function returns a value. The types of values returned are as follows: Number, Date, or Boolean (i.e. a value that can only be 1 or 0). In our example, the returned value will be of type Number.

 

Calculation formula syntax