In this article:
Inserting Custom Functions and Methods
Example of Inserting Functions and Operators into Expression
Function is an order of operations executed with operand on calculating expression. Operator is an action performed with operand on calculating expression. In expression editor functions and operators can be inserted by means of the functions panel or entered from keyboard.
It is available to insert:
System Functions. System functions are available in the expression editor right after Foresight Analytics Platform is installed.
Custom Functions and Methods. Custom functions and methods can be used to enhance expression capabilities due to the use of custom calculation methods. The functions to be used must be written in the Fore or Fore.NET language, must have the Public identifier, and must be saved in the current repository.
Operators.
Available functions and operators depend on the object, for which an expression is created.
To get a brief description of function or operator, select it on the functions panel. The description is displayed at the bottom of the panel. The desktop application enables the user to get a link to a full description of function or operator. To do this, click the Full Description link located at the end of the brief description.
TIP. If it is required to view description of function or operator used in the expression, open the context menu and select the Description item to view brief description on the data panel, or the Help item to view the help for the selected function or operator. The option is available only in the desktop application.
System functions are available in the expression editor right after Foresight Analytics Platform installation.
NOTE. If the data provider does not contain a calendar dimension, the functions using calendar dimension are unavailable in the expression editor. If a data provider contains several calendar dimensions, the dimension, for which the Timeline type is specified.
To insert system function:
Select the Functions radio button on the functions panel. All available functions are displayed. For example:
Select the function in the list or find it by means of search.
Click the Insert into Formula button or double-click the function or drag the function to the expression area.
NOTE. System functions are also represented by time and dummy variables. They can be inserted only from the functions drop-down list. To call it put the cursor to the expression area and press CTRL+Space. In the displayed list, select the required time or dummy variable and double-click it. It will be inserted instead of the cursor position. For details see the Time and Dummy Variables.
The function is inserted into the expression area to the cursor position. Brackets for entering function parameter values are inserted at the same time. If there are several parameters, they are separated with a comma. For example, the SubTotal function looks as follows right after it is inserted into the expression area:
SubTotal(, , )
Enter function parameter values one by one.
The desktop application can display a tooltip for the current parameter, and a tooltip with available parameter values. To do this, put the cursor to the required parameter and press CTRL+SPACE. All available tooltips are displayed, for example:
The tooltip for the current parameter is displayed at the top, the tooltip with available parameter values is displayed at the bottom. The following can be used as parameter values:
Enumeration values.
Operands.
Functions.
Data source parameters.
As a result, the function is inserted into the expression, for example:
SubTotal({Coal mining[t]},null ,PivotTotalPosition.Columns)
TIP. If name of the function to be used is known, it can be entered from keyboard. A tooltip with parameters and function parameter values is automatically displayed in the desktop application.
Custom functions and methods can be used to enhance expression capabilities due to the use of custom calculation methods. The functions to be used must be written in the Fore or Fore.NET language, must have the Public identifier, and must be saved in the current repository.
To insert custom function:
In the expression area, put the cursor to the position where the custom function must be located.
Enter the full path to the function. Path format is different depending on the function type:
User Fore function:
<Unit identifier>.<Function name>
User Fore.NET function:
<Fore.NET assembly identifier>.[<Namespace>].<Class name>.<Function name>
If name space is not determined, the .NET assembly name space is used by default.
If an application function contains parameters, enter them in parentheses right after the full path to the function.
As a result, the application function is inserted into the expression, for example:
CALCFUNC.UserCalculation({Number of companies[t]}, 100)
TIP. If it is required that your application function is displayed in the list of system functions, connect it on the functions panel into the Custom Functions special category. Such functions are inserted identically to system functions. For details see the Connecting Custom Functions section.
Operators are used to mark operations executed with operands.
To insert operator:
In the expression area put the cursor to the position where the operator must be placed.
Enter the operator using keyboard or select the Operators radio button on the functions panel. All available operators are displayed. For example:
Select operator in the list or find it by means of search.
Click the Insert into Formula button or double-click the operator or drag it to the expression area.
As a result, the operator is inserted into the expression area.
The example is used to create an expression by means of functions and operators. Indicator's annual values in roubles and US dollar rate are used to calculate indicator value in US dollars and is interpolated to the semi-annual frequency:
See also: