The Variant datatype is widely used in the Component Object Model to represent variables with no explicitly defined type. The datatype of the value stored in a Variant variable can be defined at runtime, when the value is assigned.
C/AL supports Variant variables and a variety of functions that help to identify the type of a variable content.
The following example runs a database query through the ActiveX Data Objects (ADO) library. Field values in the resulting recordset are returned as Variant data that can be interpreted by the client C/AL code.
The code for this example will be implemented in a
Page
object. Run the NAV object designer and create a page. Select the Customer table as a data source from the page, and then select the List page type in the page wizard.In the Action Designer page, create a
Show Balance
action button. Open the action trigger code and declare local variables required in the function:Name
DataType
Subtype...