Input Variables are declared between the input and the var keywords. This section is optional.
input
nDate
var
// declare some variables
begin
// macro body
end
Variables are declared by simply listing them in the declaration block, the same way it is done in the var block.
| • | You do not need to declare the type of the variables, since it is determined by the first letter of the variable name. |
| • | Do not use any separators such as commas to separate the variable. |
| • | Note that the list of variable can extend onto as many lines as you wish. |
The specificity of input variables is that their value comes from the input variables part of the Macros RulesScriptLine Property. This means that a macro can be made very generic and reusable.
input
sHolList
var
begin
bRESULT = HolidayOfListOnDate(sHolList, n_TokenDate)
end
The macro above tests if there is a holiday for a given Holidays List (presumably to change the text/background color of the textbox containing that holiday). By using input variables, this same macro can be reused by any DiaryGridline to test for any Holidays List. Without input variables you would have had to write 5 different macros,
bRESULT = HolidayOfListOnDate('a', n_TokenDate)
...
bRESULT = HolidayOfListOnDate('u', n_TokenDate)
each with the main code line being different.