Literals (Magic xpa 3.x)
Numeric values are written without any special identification. For example, 123 and 15.52 are numeric literals.
Literals other than numeric values are treated as alpha strings, and are normally enclosed within single quotes. All alpha strings, except for plain text, include a literal code that identifies the type of the data enclosed within the single quotes. The literal code, however, is itself not enclosed in quotes, and immediately follows the string to which it refers. For example 'adcd' is treated as plain text, while '01/01/92'Date is treated as a date.
Magic xpa translates literal strings into a Magic xpa internal representation while it parses an expression containing the string. At runtime, Magic xpa uses the actual internal values for expression evaluation. As internal values, Magic xpa keeps track of any changes that may occur to the values represented by literals.
For example, the string '1'DSOURCE represents the first entry in the Data repository. If a new entry is inserted before the first entry, causing it to become the second entry, Magic xpa will automatically update the literal string to read '2'DSOURCE. This will preserve the original meaning of the expression.
Another use of literals is to improve portability of the Magic xpa program from one natural language environment to another. For example, it may be desirable for the task mode mnemonic 'MCDQLRUSFOE' to have different meanings in different languages. By specifying the MODE literal as in 'MCDQLRUSFOE'MODE Magic xpa will automatically translate the valid task modes within the string to their appropriate values in the specified target language.
Literals make expressions more robust and less susceptible to unintentional damage due to changes in other parts of an application.
Following is the list of available literals:
|
|
|
DATE
|
The string is interpreted as a date. It may participate in arithmetic operations since its internal representation is of a numeric value. '01/01/97'DATE+14 is a valid expression which yields the date 15/01/97.
The Century Start environment setting affects results of DATE actions. '01/28/97'DATE will be interpreted as a date in 1997 if Century contains a year greater than 1892 and less than or equal to 1997, and it will be interpreted as a date in 2097 if Century contains a year greater than 1997 and less than or equal to 2097. Magic xpa expands year values to a full four digit equivalent.
|
'01/01/97'DATE
|
DSOURCE
|
The string is interpreted as the sequence number of a data source in the Data repository. The use of the DSOURCE literal enables Magic xpa to update the data source number as its relative position changes within the Data repository. '5'DSOURCE refers to the fifth line in the Data repository at the time of creation of the entry. Magic xpa will automatically maintain the correct number.
|
'1'DSOURCE
|
ERR
|
The ERR literal relates to the errors specified in the Automatic Retry topic.
|
'Deadlock'ERR
|
EVENT
|
The string is interpreted as a Magic xpa internal event identifier. Events are the instructions that Magic xpa received as a result of a user interaction. Events are generated by translations of key strokes through the Keyboard Mapping repository. The Magic xpa internal events can be used in expressions for purposes of testing user activity, and creating macros. Event names can be seen in the Settings>Keyboard Mapping>Internal Event column. These names should be used in the event string. It is enough to type the first few characters of the internal event descriptor and Magic xpa will complete the literal. In cases of ambiguity, type more letters.
Note: The EVENT literal is not available for Rich Client tasks.
|
'Exit'EVENT
|
EXP
|
The EXP literal is what allows Magic xpa to keep track of the expression if it moves.
This literal declares the string as an expression identifier. It is used as input with the ExpCalc function. The EXP literal will allow any relocation of the expression it represents.
|
'3'EXP
|
FORM
|
Declares the string as an identifier of a specific form defined in the forms repository. Used as input in the Main Display property of a task in order to dynamically display a different form. The FORM literal will allow any relocation of the form it represents.
|
'2'FORM
|
INDEX
|
The string is interpreted as the number of an index in the Index repository. This is referring to an index in the task's main data source.
The use of the INDEX literal enables Magic xpa to update the index number as its relative position changes in the Index repository. For example, '5'INDEX refers to the fifth line in the Index repository when the index was created. If that index is moved to a different line, Magic xpa will automatically maintain the correct number.
|
'5'INDEX
|
KBD
|
The string is interpreted as a keyboard value. Keyboard values are the raw input to Magic xpa. The keyboard values are translated to internal events according to the Keyboard Mapping repository. The same key may generate several different internal events according to context. KBD values may be used in expressions for the purpose of testing user input and creating macros. KBD names can be seen in the assigned key column of the settings/keyboard mapping. These names should be used in the strings.
Note: The KBD literal is not available for Rich Client tasks.
|
'F2'KBD
|
LOG
|
The interpreted value of the string is either True or False (1,0 respectively). The allowed strings are 'TRUE'LOG and 'FALSE'LOG. Any other string with the LOG literal will be converted to 'FALSE'LOG.
|
'TRUE'LOG
|
|
The MENU literal supports expressions for menus. '1'MENU will be evaluated to the first menu in the Menu repository, which is normally the Default Pulldown menu.
|
'1'MENU
|
MODE
|
The string is treated as a task operation mode. The available modes are all the valid entries for the Initial Mode field in the Task Properties sheet. When a Magic xpa program is ported to another natural language environment, the MODE literal can be used to preserve meaningful mnemonics in the new language.
|
'MC'MODE
|
PROG
|
The string is interpreted as the sequence number of a program in the Program repository. The PROG literal is what enables Magic xpa to keep the program number synchronized if the program gets moved within the Program repository.
'5'PROG refers to the fifth line in the Program repository at the time of its creation. Magic xpa will automatically maintain the correct number. If you enter '5'PROG as a program expression in the Expression Editor, and later insert a new program in the Program repository, ahead of the fifth program, thereby changing the old program entry from #5 to #6, Magic xpa will automatically change the '5'PROG to '6'PROG in the expression.
Note: When the Find Reference utility is activated, using the PROG literal will enable Magic xpa to locate an expression that refers to a program.
|
'5'PROG
|
RIGHT
|
Declares the string as a rights identifier. Used as input with the Rights function, allowing the developer to query whether the user has the given right. If the developer does not own a right, its literal will appear.
|
'RIGHT#4'RIGHT
|
TIME
|
The string is interpreted as a time value. It may participate in arithmetic operations since its internal representation is a numeric value. '14:30:15'TIME+5 is a valid expression. Values added to a time value are treated as seconds.
|
'14:30:15'TIME
|
VAR
|
Declares the string as a variable identifier. Used as input with the VarAttr, VarCurr, VarMod, VarName, VarPrev, and VarSet functions. The VAR literal will allow any relocation of the variable it represents due to selection of other variables.
|
'A'VAR
|