EBSILON®Professional Online Documentation
EbsScript / EbsScript Interface Units / InterfaceUnit-Variant
In This Topic
    InterfaceUnit-Variant
    In This Topic

    InterfaceUnit - Variant

    Data type “Variant” : Can be interpreted as integer, a real or a string. The definition and the available functions are present in the interface-unit “Variant”. This can be opened in the EbsScript-Editor with “File“ “Open interface-unit”.

     

    Name

    Purpose

    Arguments

    Return value

    Example

    VarAsType

    Changes one variant into a variant of another type.

    1: VARIANT: original variant

    2: VARIANT: variant of requested type

    VARENUM

    uses @variant;

    var

        v,v1:VARIANT;

        str:string;

    begin

        if (VarIsEmpty(v)) then

        begin

            println ("v is empty");

        end;

        v.vt:=varReal;

        v.rval:=77.7;

        println (v.rval);

        if (VarType(v)=varReal) then

        begin

            println ("v is real");

        end;

        VarAsType(v, v1, varInteger );

        println (v1.ival);

        str:=VarToStr(v);

        println (str);

        VarClear(v);

        println (v.rval);

        if (VarIsEmpty(v)) then

        begin

            println ("v is empty");

        end;

    end.

    VarClear

    Deletes the value of a variant.

    1: VARIANT

    -

    VarIsEmpty

    Checks whether a variant is empty.

    1: VARIANT

    BOOLEAN:
    true: Yes
    false: No

    VarToStr

    Returns the value of a variant as text (string).

    1: VARIANT

    string

    VarType

    Returns the type of a variant.

    1: VARIANT

    VARENUM

    VarFromBoolean

     Converts a boolean value to variant

     1: BOOLEAN

     VARIANT

    VarFromDate

     Converts a date to variant

     1: REAL

     VARIANT

    VarFromEbsClass

     Converts an object of type EbsClass to variant

     1:EBSCLASS

     VARIANT

    VarFromError

     Converts a value of type ERRORENUM to variant

     1:ERRORENUM

     VARIANT

    VarFromInteger

     Converts an integer value to variant

     1:INTEGER

     VARIANT

    VarFromPointer

     Converts a value of type pointer to variant

     1:POINTER

     VARIANT

    VarFromReal

     Converts a real value to variant

     1:REAL

     VARIANT

    VarFromString

     Converts a string value to variant

     1:STRING

     VARIANT

    VarArrayCreate

    Creates a variant array with the bounds given by Bounds and the element type given by vt. 
    The Bounds parameter must contain an even number of values, where each pair of values specifies the upper and lower bounds of one dimension of the array.

    1:ARRAY * OF INTEGER: Bounds               

    2: VARENUM: vt

    VARIANT
                   

     

     

    VarArrayDimCount

     Returns the length of the variant array

    1:CONST VARIANT:               

     

    INTEGER
                        

     

     

    VarArrayGet

     

    1:CONST VARIANT

    2:CONST ARRAY * OF INTEGER               

     

    VARIANT
                   

     

     

    VarArrayHighBound

     

    1:CONST VARIANT;

    2:INTEGER                

     

    INTEGER
                   

     

     

    VarArrayLowBound

     

    1:CONST VARIANT;

    2:INTEGER      

                  

     

    INTEGER
                   

     

     

    VarArrayPut

     

    1:VARIANT

    2:CONST VARIANT

    3: ARRAY * OF INTEGER