Performing Row Calculations

Previous  Home topic  Next  Print this topic Send Feedback

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).

 

Row Calculations Example

 

Document Icon

1.With a form loaded in the Layout view of the Form Designer, drag and drop a Table object onto the Layout canvas.
2.Assign a name and column type to each column through the Table Properties bar.
3.On the Table Properties bar under Behaviors, click the Table Changes Field Data behavior event. PerfectForms™ launches the Behavior view.

Note: The Table Changes Field Data event will be called whenever any data is changed anywhere in the table. So, when either the Price or Tax cells are edited, the behavior will be called.


4.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.
5.In the Set Field Properties bar, click Select and navigate to the field that will receive the calculated value.

Set Field Behavior

6.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.
7.On the Set Field Properties bar under the Value section, choose Formula as the value.
8.Click Compose. The Compose Formula dialog is shown.

Select Field Option

9.Choose the Field option and click Select.
10.Locate the first field you want to put into the calculation and click OK.

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


11.Click the Add Line button.
12.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.

Second Row Field Selected

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

 

Updated: 06/12/2011  Page url: http://www.perfectforms.com/Documentation/manual/html/?fl_row_calculations.htm
PerfectForms™ -- forms software, workflow software, and business process management