Calculation Formulas

Use

There are two ways of calculating the value of a field.

  • Using a calculation formula

  • Using the information that is entered onto the selection screen.

Using a calculation formula to determine the value of a field

In its simplest form, a calculation formula consists of a single formula. The usual mathematical rules apply to all formulas. Formulas consist of operands and operators.

  • Valid operands include the short names of fields as well as numeric constants (10 or 1.5, for example) and character strings ('ABC', for example).

  • There are a number of special fields that are available as standard.

    • %NAME (the name of the user processing the query)

    • %DATE (the current date, on which the query is processed)

    • %TIME (the current time, at which the query is processed).

  • If an operand is a text field, you can use the notation textfeld [n:m] to access part of this field. n is the position of the first character and m is the position of the last character.

  • If an operand is a date or time field, you can use the following notation to access the individual components of this field:

    date field [YEAR]

    Year

    date field [MONTH]

    Month

    date field [DAY]

    Tag

    time field [HOUR]

    Hours

    time field [MINUTE]

    Minutes

    time field [SECOND]

    Seconds

  • Valid operators include the basic arithmetic operations plus DIV and MOD. DIV is the operator for whole number division and MOD is the operator for the remainder of the whole number division.

  • You use parentheses in the usual way.

Determining the field value from the information on the selection screen

In this case, the local field is treated like a parameter whose value is determined once by an entry on the screen. This option is not available for symbol fields or icon fields.

You select the Obligatory field, if you want to make it compulsory to specify a value for this particular field.