FORMULA

Contents


"Formula" launches the formula editor in a full-screen box.

 

Syntax

Formula formula Asabrev

 

Parameters

Element

Description

Restrictions

formula

Alphanumeric expression that results in a formula

abbrev

Abbreviation that describes the box

 

Examples

#- Initilization of the formula and opening of the formula editor
FORMULE = "date$"
Formula FORMULE As [FML]

#- Declaration of the elements
#- in the list of fields and variables
Field [FML] 4, "", "ZMOTTBX", "Table ZMOTTBX", "", ""
Field [FML] 4, "ZMOTTBX", "ZMOTTBX.YITMREF_0", "Product              ID",      "", "[F:ZMT]YITMREF"
Field [FML] 4, "ZMOTTBX", "ZMOTTBX.YITMDES_0", "Product Description",     "", "[F:ZMT]YITMDES"
Field [FML] 4, "ZMOTTBX", "ZMOTTBX.YITMSHO_0", "Abbreviated Title", "",     "[F:ZMT]YITMSHO"

#- Display of the formula editor
Boxact [FML]

$SAISIE
#- Entry in the formula editor
Boxinp [FML] Using REPONSE, FORMULE
Case REPONSE
    When 1: Gosub VERIFICATION: Goto FIN
    When 46: Gosub VERIFICATION
    When 7: Goto FIN
    When Default:
Endcase
Goto SAISIE

#- Verification of the formula's valid structure -#
$VERIFICATION
E = abs(parse(FORMULE))
If E
    Errbox errmes$(E)+chr$(13)+errm
Endif
Return

$FIN
#- Closing of the box
Boxclr [FML]
Close Local Inpbox [ZI1]
Close Local File [ZI1]
End

 

Description and Comments

"Formula" launches the formula editor in a full-page box. This box is identified by an abbreviation that you will use to insert/display/enter/delete elements in the list of fields and variables on the screen or delete the box with the Field, Boxact, Inpbox, Boxclr and Close Inpbox instructions from the memory.

In this box, three buttons are set at the bottom of the box:

·         OK Button:                 Allows you to exit from the box and retrieve the formula

·         CANCEL Button:    Allows you to exit from the box without retrieving the formula

·         VERIFY Button:    Allows you to verify the formula entered.

The processes related to these buttons are to be programmed.

The following statuses are returned after an entry in the formula editor:

 

Statuses

Where-used

1

returned by clicking on the "OK" button

7

returned by clicking on the "Cancel" button

46

returned by clicking on the "Verify" button

47

returned by clicking on the parent element without a child element
- allows you to generate child elements

 

Remarks

The Close [Local]Inpbox instruction deletes the box that was opened for the formula editor by Formula from the memory.

When a subroutine terminates, the boxes opened by Formula in this subroutine are closed as if you had performed a Close [Local]Inpbox.

It is preferable to apply the AFR data type to the field for the entry of a formula. This data type provides access to the formula editor in the right-click menu of the field and confirm the syntax of the formula entered. Five tables can be passed in parameters in order to load the list of fields and variables of the formula editor.

 

Associated Errors

 

Associated Keywords

Field - Boxact - Boxinp - Boxclr - Close - Status

 


Contents


Copyright © Sage 1999 - 2007