C/AL Function Statements
You use function statements to execute either built-in system functions or user-defined functions. Function calls may include parameters, which are passed to the function.
If you assign the return value of a function call to a variable, then you use the function statement as part of an assignment statement.
The following example calls the INIT Function (Record) on a record variable. This example requires that you create the following variable.
The following example calls the CALCDATE Function (Date) and assigns the return value to a variable. The CALCDATE function has two parameters. This example uses the DateExpression and ReferenceDate variables in the function call. The values of the variables are passed to the CALCDATE function.
This example requires that you create the following variables.
DateExpression := '<-7D>' ReferenceDate := 112509D; NewDate := CALCDATE(DateExpression, ReferenceDate);
After you run the code in this example, the NewDate variable represents the date November 18, 2009.