Show Return Values or C/AL- Variables
You can use virtual tables to show return values of functions or variables on the graphic user interface. The virtual field stores in this case no data but simply serves as a placeholder to send any data from C/AL to the client. The concept is similar to the use of global variables in pages in the Microsoft Dynamics NAV 2018 client.
An example for this is in the core application of the Anveo Web Portal. The example is in the last lines of the OAGetField_EXAMPLE() function within the codeunit ACF Events Admin/Examples.
IF (AnveoPageElementField."Virtual Table Code" = 'EXAMPLE') AND
(AnveoPageElementField."Virtual Field Code" = 'VIRTUALFIELD_OUT') THEN
FldRef.VALUE := ACFExample.GetVolumeText();
To display an function return value do the following:
- Create a virtual table with one field that should be displayed and set the visibility to Read Only.
- Add this virtual field to the Anveo Page on which the return value / variable should be displayed.
- Set the field value in the trigger OnAfterGetField in codeunit ACF Events or in your module (like in the example shown above using the FldRef.VALUE). Identification of the field can be done by the Field Name or by a combination of Virtual Field Code and Virtual Table Code.