Next, we will add some behaviors to the . The table object on the form allows the applicant to add detail lines to the request. Once a line has been added, we need to add a to calculate the line value (Qty X Price = Value) and then sum the total in the value column to make the request value.

|
| 1. | In Layout view, select the table object by clicking below the bottom visible row. |
| 2. | On the under Behaviors, click the Table Changes Field Data . |

| 3. | To set up the row calculation behavior, drag a Set Field command onto the . |
Note: The Start and Exit objects are just for visual reference and are not needed as part of the behavior sequence. The sequence will automatically start at the command that does not have a connector arrow leading to it and run in the direction of the arrows and any conditional logic that is added. We will see this in a later example.
| 4. | In Set Field Properties there are three areas: |
| • | Field - This is where you specify the object field where the result of the behavior will be placed. |
| • | Value - The value of the result of the behavior. This could be fixed text, the value of another field, a system field or an advanced formula. |
| • | Summary - This is to set a comment which is a visual cue shown on the command in the Behavior view and does not have any effect on the behavior. |
| 5. | On the Properties bar in the Field section, click Select. |
| 6. | Browse to Details then Table and select Value – Current Row. |
| 7. | Choose Formula and click Compose. |
| 8. | On the the single <empty> line will be selected. Change the value of the line by selecting the Field radio button. |
| 9. | Click Select to open the Select a Field dialog. |
| 10. | Browse to Details then Table and select Quantity – Current Row. |
| 12. | Select the + operator and select * in the right hand pane. |
| 13. | Repeat steps 8 – 10 above, this time selecting Price – Current Row. |

Note: Remember that the table should be considered as a group of objects inside a table and, therefore, it is possible to identify the individual columns in behaviors.
| 14. | On the Properties bar, clear the Auto-Summary check box. |
| 15. | In the Comment box, type Calculating row value = quantity x price. |
| 16. | Drag open the Set Field command so you can see all of the resulting text. |
| 17. | Now, we have to make the column calculation add the value column and put the result in the Total field. Add a second Set Field command to the canvas underneath the first. |
| 18. | On the Properties bar in the Field section, click Select and browse to select Total. Click OK. |
| 19. | On the Properties bar, next to the Formula option, click Compose. |
| 20. | In the Formula Editor, delete the <empty> line by selecting it and clicking the Delete button . |
| 21. | Click the Add Function button. |
| 22. | In the options, scroll down and select Sum. |
| 23. | Click on the <empty> line. |
| 24. | Select the Field radio button and click Select. |
| 25. | Browse to Details then Table and select Value – All rows. |
| 26. | Click OK and OK again to close the Formula Editor. |
| 27. | Join the two commands using the yellow path points around the edge of each command. |

|
Updated: 6/6/2011
Page url:
http://www.perfectforms.com/Documentation/complete_tutorial/html/?bb_add_a_calculation_to_the_table.htm
PerfectForms™ -- forms software, workflow software, and business process management