Performing Column Calculations

Previous  Home topic  Next  Print this topic Send Feedback

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

 

Example

We want to add all values in a column (Total) together to populate a field outside the table (Grand Total).

Example Image

 

Document Icon

1.With a form loaded in the Layout view of the Form Designer, drag and drop a Table object from the Toolbox onto the Layout area.
2.On the Table Properties bar under Columns, change the Column Data Type to Numeric Input.
3.On the Table object in the Layout area, select the Column. You can select a column in one of two ways.
With the Table object selected, in the columns section of the Properties bar, double-click on the header cell of the row that describes the table column you want to select.
In the Table object within the Layout area, click in the header area of the column. You will need to de-select (click somewhere outside) the table before doing this.
4.On the Properties bar under the Behaviors section, click the Numeric Input Changes Field Data behavior event. PerfectForms™ launches the Behavior view.

Note: The Numeric Input Changes Field Data event will be called whenever data is changed in any of the rows under this column.


5.In the Behavior view toolbox under the Objects Commands section, drag and drop a Set Field command onto the Behaviors canvas. This behavior will perform the calculation.
6.On the Set Field Properties bar, click Select to choose the target field for the calculation (e.g. Grand Total).
7.In the Value property section, select Formula and click the Compose button.

Value Property Section

8.Delete the <empty> line (which is always shown by default when composing a new formula) and then click the Add Function button.
9.In the Function list, select the Sum function.
10.In the editor window under the newly added Sum function, select the <empty> line so we can specify the column to sum.
11.Select Field and then locate the column that you want to add (e.g. Total - All Rows).

Select a Field Dialog

The Formula Editor will now look as follows:

Compose Formula Dialog

12.Click OK. You can save and preview your form to test the behavior. Whenever a value is entered in the Total column, the Grand Total will be updated.

 

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