Variables

Variables In all strings “…” within a script command line you can use variables that stand for field values of the current screen or of previous screens. Before the system interprets the script command, it replaces all variables by their corresponding values. The name of a variable consists of the &-sign followed by the field name within square brackets, e.g. &F[Account]

Example: 

Title “Display account &F[Account]  

If the current value of F[Account] is 113100, the Script command is equivalent to 

Title Display account 113100″  

You can also extract substrings with the notation &F[...](a-b) where a denotes the first character to be extracted and b the last one. Example: &F[Account](3-4)” is replaced with “31″ if the whole account number is 113100.

It may sometimes be necessary to use input values from previous screens. For example, the user could have entered a product number in the first screen of a transaction and you wish to use this product number in the second screen for displaying a product image. In this case you have to put two colons prior to the field name. Example: 

Image (4,80) “P:\products\img&[::Material number].jpg” 

If the user entered the product number 00500187 on the first screen, the image file P:\products\img00500187.jpg is displayed on the second screen. 

A special predefined variable is the current date &[today_...] in various formats. You can use the letters d=day, m=month and y=year in order to define the date format that you need. Examples for December 24th, 1999:

&[today_dmy] 24121999
&[today_mdy] 12241999
&[today_y] 1999
&[today_m/d/y] 12/24/1999

You can also add or subtract a given number of days from the current date. Examples for December 24th, 1999:

&[today+1_dmy] 25121999
&[today-1_dmy] 23121999
&[today+8_m/d/y] 01/01/2000

Variables – Basics