ISBOOLEAN Function (Variant)

Indicates whether a C/AL variant contains a Boolean variable.

Ok := Variant.ISBOOLEAN

Parameters

  • Variant
    Type: Variant

Property Value/Return Value

Type: Boolean

true if the C/AL variant contains a Boolean variable; otherwise, false.

Example

The following example determines whether a C/AL variant contains a Boolean variable. The code initializes the MyBoolean variable with a Boolean value. The MyBoolean variable is assigned to the variant variable that is named MyVariant. The ISBOOLEAN function determines whether the variant contains a Boolean variable and stores the return value in the varResult variable. In this case, the variant contains a Boolean variable so Yes is returned and displayed in a message box. The Boolean value is obtained from the Critical field in the Item table. The ISCODE Function (Variant) determines whether the variant contains a code variable. The return value is No because the variant does not contain a code. This example requires that you create the following variables and text constants in the C/AL Globals window.

Variable name DataType Subtype

ItemRec

Record

Item

MyBoolean

Boolean

Not applicable

MyVariant

Variant

Not applicable

varResult

Boolean

Not applicable

Text constant name ConstValue

Text000

Does the variant >%1< contain a Boolean variable? %2

Text001

Does the variant >%1< contain a code variable? %2

MyBoolean := ItemRec.Critical;
MyVariant := MyBoolean;
varResult := MyVariant.ISBOOLEAN;
MESSAGE(Text000,MyVariant,varResult);
varResult := MyVariant.ISCODE;
MESSAGE(Text001,MyVariant,varResult);

See Also

Reference

Variant Data Type