Modifier

Partager via


Variant.IsTime() Method

Version: Available or changed with runtime version 1.0.

Indicates whether an AL variant contains a Time variable.

Syntax

Ok :=   Variant.IsTime()

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 Time variable, otherwise false.

Example

The following example determines whether an AL variant contains a time variable. The code initializes the MyTime variable with a Time value. The MyTime variable is assigned to the variant variable that is named MyVariant. The IsTime method determines whether the variant contains a Time variable and stores the return value in the varResult variable. In this case, the variant contains a Time variable so Yes is returned and displayed in a message box. The IsCode Method (Variant) determines whether the variant contains a Code variable. The return value is No because the variant does not contain a code.

var
    MyTime: Time;
    MyVariant: Variant;
    varResult: Boolean;
    Text000: Label 'Does the variant >%1\< contain a time variable? %2.';
    Text001: Label 'Does the variant >%1\< contain a code variable? %2.';
begin
    MyTime := Time;  
    MyVariant := MyTime;  
    varResult := MyVariant.IsTime;  
    Message(Text000,MyVariant,varResult);  
    varResult := MyVariant.IsCode;  
    Message(Text001,MyVariant,varResult);
end;

Variant Data Type
Get Started with AL
Developing Extensions