Placing a Calculated Value on a Form
This example shows how to place a calculated value on a form. The example is based on the invoice_items table of the AlphaSports sample database.
Display the Forms tab of the Control Panel.
Click New, select the invoice_items table, and click Next >.
Select Custom Form and Next >.
Select "Price" in the Available Fields list and click '>'.
Select "Quantity" in the Available Fields list and click '>'.
Click Next > and Finish. The Form Editor will now display a form that looks something like this:
Select and drag the "" entry from the Drag Drop list onto the form. This will display the New Calculated Field dialog.
Enter "Total" into the Name control.
Click the 'xy' icon in the Expression control to display the Expression Builder.
Double click Field Name in the upper left corner of the dialog. Select "Price" and click Insert.
Place a multiplication symbol after "Price", so the expression is "Price*".
Double click Field Name in the upper left corner of the dialog. Select "Quantity" and click Insert, so the expression is "Price*Quantity".
Click OK to return to the New Calculated Field dialog.
Click OK to return to the Form Editor.
Click to switch to form view.
Enter a value into the Price field, then the Quantity field. Alpha Anywhere will calculate the value of the Total field.
The labels and controls clearly need formatting. For more information, see Setting Field Properties.