Tips & Tricks - Calculation

This article explains how to perform calculations in view tables using the formula editor.

Summary calculation

With this type of calculation, the calculated value is output below a table column.

First, create a new application based on the "Basic application" template.

You will find a view table on the "All entries" page. For the calculations we use a floating-point number data field, which is integrated in the table. Go to the "Entry" input page.

Double-click on the grid line where the "Title" input field is located to switch to the zoom area.

Here, create a new input field below the title. The properties dialog opens automatically.

Select the "New data field" option and click "Next".

Give the new edit field the title "Value" and select the control type "Floating-point number". Click "Next". After the following final settings, click "Finish".

Go back to the "All entries" page and open the properties dialog of the view table there.

On the "All entries" page (1), open the properties dialog of the view table (2) with a double click. Click on "Add column" (3) to apply the new "Value" data field (4). General information for creating a new table column can be found here.

Save the change by clicking "OK".

Also confirm the properties dialog of the view table by clicking "OK" and then open the properties dialog again.

Click on "Edit total calculation".

Here, select the cell below the "Value" column and click on "Add control".

Then select "Calculation" from the menu that appears.

You can enter the formula by clicking on "Edit control".

Enter a title and click on "Edit formula".

The library contains a collection of Intrexx formulae. In the "Functions" category, select under

"Table functions / Aggregate functions for column values / Column values of data records (current view) / Total"

the formula "Sum of control". The formula

sum(table("<tableGuid>"), row("<tableControlGuid>", <fallbackValue>))

can be added to the workspace of the editor by double-clicking on it.

If the "Application structure" tab is not visible in the area to the right of "Libraries", use the "View / Application structures" menu to make it visible.

The view table can be found in the application structure under "All entries / FormGroup / Grid / Container 2".

Select the entry "tablerecords" there.

Replace <tableGuid> in the formula with the GUID shown in the bottom right area. To do so, simply select the part of the formula in the workspace and then double-click on the GUID under the application structure. The GUID is then automatically inserted and overwrites the selected part of the formula.

Replace <tableControlGuid> with the GUID of the "Value" control.

An optional fallback value is not required in our example - this can be removed from the formula.

Close all opened dialogs by clicking "OK", save the application, and test the result in the browser by entering values in the application.

Calculation in separate table column

It is also possible to create a separate table column for the calculation - as in the figure above with the same formula, which then outputs the sum per row in the "Value 2" column.

For the type of calculation, simply select the "Calculation" menu when creating a new table column. The steps that follow are already familiar from the summary calculation.

More information

View table - Calculations

Formula editor