Version 8.3.4
 —  Ajax Developer  —

Using the Formula Editor

This document covers the following topics:


About the Formula Editor

The formula editor can be used, for example, to define that the sum of the fields A and B is to be shown in field C. In this case, the formula has to added to field C.

Important:
The formula is processed on the client side.

Top of page

Opening the Formula Editor

When you open the formula editor, you can add or remove a formula.

The prerequisite for adding a formula for a field is that an adapter class or Natural adapter with the corresponding code exists. The formula editor only works with fields that have valid declared properties on the adapter side.

Start of instruction setTo open the formula editor

  1. In the layout area or preview area, select the field control for which you want to add a formula.

  2. From the Ajax Developer menu, choose Insert/Edit Formula.

    A dialog appears. If a formula has already been defined for the selected field, it is shown in the dialog.

    Formula editor

    Important:
    A function is always defined from the left to the right. It is not possible to go back in the function, for example, in order to insert a missing operator. Therefore, you should already have a plan of your function in mind before you compose the function using the controls in the formular editor.

    The following command buttons are provided:

    Command Button Description
    Insert Function Allows you to select a function (such as sum) from a drop-down list box. After you have selected a function, you define the required fields using an "insert field" link. A simple example is provided below; see Adding a New Formula.
    Insert Operator This button is only shown when applicable, that is, if at least one expression has been entered. Allows you to select an operator (such as the plus sign) from a drop-down list box.
    Insert Constant Allows you to define a constant (for example, the number "77") in a text box.
    Insert Bracket Allows you to select brackets from a drop-down list box.
    Reset Formula Deletes the formula.

Top of page

Adding a New Formula

This section explains how to define a simple formula: the sum of the fields Value A and Value B is to be shown in the Sum field.

Example

Start of instruction setTo add a simple formula

It is assumed that the formula editor has been invoked as described above (the field was selected in which the sum is to be shown).

  1. Choose the Insert Function button.

    The following information is now shown at the bottom of the dialog.

    Formula editor

  2. Select the required function (for this example, select sum) from the Functions drop-down list box and choose the OK button.

    The information at the bottom of the dialog is no longer shown. The selected function is now shown in the Formula text box, together with the link "insert field".

    Note:
    It is not possible to edit the formula in the Formula text box.

  3. Choose the "insert field" link in the Formula text box.

    The fields that are currently defined in the layout are now shown at the bottom of the dialog. Example:

    Formula editor

  4. Choose a field (for this example, choose valueA).

    The selected field is now shown in the Formula text box. The link "insert field" is still shown in case you want to insert more fields.

  5. Insert all required fields as described above (for this example, choose valueB).

    For this example, the formula should look as follows:

    sum(valueA,valueB)
  6. When the formula is complete, choose the Cancel button.

  7. To close the formula editor, choose the OK button.

    You can now test the formula in the preview area.

Top of page

Displaying an Overview of All Defined Formulae

You can display a list of all formulae which are defined in the current layout.

Start of instruction setTo display an overview

Top of page