Show/Hide Toolbars

PerfectApps™ Help Guide

Row calculations can be set up to add cell values together in order to populate the resulting value into another cell in the table row. In order to do this, you must set a behavior command to run the calculation and populate the target cell. For more information on setting behaviors, see the Adding Behaviors topics.

 

Example

In the example detailed below, we want to add two cells (e.g. Price and Tax) in a row together to populate another cell in the row (Total).

 

Performing Row Calculations - Table Columns

 

Document Icon

1.With an app loaded in the Layout view of the App Designer, drag and drop a Table object onto the layout canvas. (A table object will contain two Text Input columns by default)

2.Add a third column to the table.

3.Assign a name and column type (Numeric Input) to each column through the Table Properties panel. (Named Price, Tax & Total)

4.Select the Price column (click in the header) and under Behaviors, click the Numeric Input Changes Field Data behavior event. PerfectApps launches the Behavior view.

5.In the Behavior view Toolbox under the Objects Commands section, drag and drop a Set Field command on to the behaviors canvas. This behavior will perform the calculation.

6.In the Set Field Properties panel, click Select and navigate to the field that will receive the calculated value.

Performing Row Calculations - Set Field Behavior

7.Notice that for each table column, there is an entry for both Current Row and All rows. In general, these are used as follows.

Current row - This means that the behavior will refer to the column cell for the currently selected row in the table.

All rows - This is used for column calculations in conjunction with functions such as Sum, Average, Count, etc. These functions are described in Formula and Condition Editor and Performing Column Calculations.

8.On the Set Field Properties panel under the Value section, choose Formula as the value.

9.Click Compose. The Compose Formula dialog is shown.

Performing Row Calculations - Comp Formula Dialog - Select Field Option

10.Choose the Field option and click Select.

11.Locate the first field you want to put into the calculation and click OK.

tipbulb

Be sure to select the field with the Current Row option, not the All Rows option.

 

12.Click the Add Line button.

13.With the new line selected, select the Field option and click Select again to select the next field to be included in the calculation. The Formula Editor  will now look as follows.

Performing Row Calculations - Comp Formula Dialog - Second Row Field Selected

14.Click OK.

15.Repeat the process for the Tax column - Numeric Input Changes Field Data behavior event, or copy the behavior from the Price column to the tax column to save time. (This step is necessary as the calculation needs to be triggered when either the Price or the Tax changes in the table.)

16.You can save and preview your app to test the behavior. Whenever a value is entered in the fields you selected to add together, the target field should receive the calculation.

 

Table Row Calculations

Table Row Calculations

(3 min)

Row calculations within a table can be built to manipulate data in a row in order to populate the resulting behavior into another field in the same row of the table or even into another field on the app.

 

See also: Performing Column Calculations

 

Return to: Adding Behaviors to a Table, Adding Behaviors, Designing an App