Enables you to apply formulas to fill out fields in different points of the system.

The formula can be created by a common mathematical expression, by an ADVPL (Advanced Protheus Language) expression, or by running a userfunction that uses memory variables provided by the system. Variables only exist when the userfunction associated with a formula is running. Thus, you must create an empty userfunction, relate it in the formula register, and then change it to add program lines.

Refer to the Create Formulas item.


Use of Formulas

Formulas are mainly used when flexibility is important, for example, in Standardized Entries.

In the fields DEBIT ACC., CREDIT ACC., and HISTORY, formulas are used to indicate where the system searches information. Thus, the DEBIT ACC. field with the prefix "11101" + customer code has the formula "1101"+SE1->E1_CLIENTE.

The system interprets that the content is composed of the code 11101 with the customer code retrieved from the Customer (E1_CLIENTE) field of the table SE1 (Accounts Receivable).

Conditioned syntaxes can also be created: For customers with the first digit of the code as “1”, the entry must be made in the account 11101 + customer code, otherwise the entry must be made in the account 11102 + customer code.

IIF(SUBS(SE1->E1_CLIENTE,1,1)=”1”,”11101”+SE1->E1_CLIENTE,“11102” +SE1->E1_CLIENTE).


Validation

Data validation fields use AdvPL language to authenticate information entered. For further information, refer to Data Dictionary.



Procedures

Adding formulas:

  1. Select Add.
  2. Fill out data according to field help instructions.
  3. Check and confirm procedure.



See Also