Variant.IsCode() Method
Version: Available or changed with runtime version 1.0.
Indicates whether an AL variant contains a Code variable.
Syntax
Ok := Variant.IsCode()
Note
This method can be invoked using property access syntax.
Parameters
Variant
Type: Variant
An instance of the Variant data type.
Return Value
Ok
Type: Boolean
true if the AL variant contains a Code variable, otherwise false.
Example
The following example determines whether an AL variant contains a code variable. The code initializes the MyCode variable with a string value. The MyCode variable is assigned to the variant variable that is named MyVariant. The IsCode method determines whether the variant contains a code variable and stores the return value in the varResult variable. In this case, the variant contains a code variable so true is returned and displayed in a message box. The IsText Method (Variant) determines whether the variant contains a text variable. The return value is false because the variant does not contain a text.
var
MyCode: Code[100];
MyVariant: Variant;
varResult: Boolean;
Text000: Label 'Does the variant >%1< contain a code variable? %2.';
Text001: Label 'Does the variant >%1< contain a text variable? %2.';
begin
MyCode := 'A1297';
MyVariant := MyCode;
varResult := MyVariant.IsCode;
Message(Text000,MyVariant,varResult);
varResult := MyVariant.IsText;
Message(Text001,MyVariant,varResult);
end;