Passing values to a function defined to receive multiple parameters, many of which have default values (and are therefore omittable), is usually accomplished by "counting commas" to ensure that the values you choose to pass are passed to the correct parameter by the parameter's position in the list. This method becomes untenable when there are many optional parameters.
The easier method is to use the following NAMED parameter syntax, which eliminates the need to include extraneous commas as place holders to put the passed values in the proper parameters:
Attr := FunctionName( [ NAMED ] AliasName := value );
NAMED | Optional. Required only when the AliasName clashes with a reserved word. |
AliasName | The names of the parameter in the definition's function definition. This must be a valid label (See Definition Name Rules) |
value | The value to pass to the parameter. |
This syntax is used in the call to the function and allows you to pass values to specific parameters by their AliasName, without regard for their position in the list. All unnamed parameters passed must precede any NAMED parameters.
outputRow(BOOLEAN showA = FALSE, BOOLEAN showB = FALSE, BOOLEAN showC = FALSE, STRING aValue = 'abc', INTEGER bValue = 10, BOOLEAN cValue = TRUE) := OUTPUT(IF(showA,' a='+aValue,'')+ IF(showB,' b='+(STRING)bValue,'')+ IF(showc,' c='+(STRING)cValue,'')); outputRow(); //produce blanks outputRow(TRUE); //produce "a=abc" outputRow(,,TRUE); //produce "c=TRUE" outputRow(NAMED showB := TRUE); //produce "b=10" outputRow(TRUE, NAMED aValue := 'Changed value'); //produce "a=Changed value" outputRow(,,,'Changed value2',NAMED showA := TRUE); //produce "a=Changed value2" outputRow(showB := TRUE); //produce "b=10" outputRow(TRUE, aValue := 'Changed value'); outputRow(,,,'Changed value2',showA := TRUE);