I'm not sure if it in 18.1 but 17.1 doesn't seem to have a method to tell what kind of variant variable you are deling with. This will make it possible to tell the native variable type from a variant.
Code:
Use Variant.pkg
Class cVariant is a cObject
// Returns true if the variant is empty.
Function IsVariantEmpty Variant ByRef vVariant Returns Boolean
Integer iType
Get VariantType vVariant to iType
Function_Return (iType = OLE_VT_Empty)
End_Function
// Returns true if the variant is NULL (not used).
Function IsVariantNull Variant ByRef vVariant Returns Boolean
Integer iType
Get VariantType vVariant to iType
Function_Return (iType = OLE_VT_Null)
End_Function
// Returns the variant type (OLE_VT_(type))
Function VariantType Variant ByRef vVariant Returns Integer
Integer iType
Move (DeRefW(AddressOf(vVariant), 0)) to iType
Function_Return iType
End_Function
End_Class
The current list of native types that the variant can hold is listed in the variant.pkg file.
Code:
OLE_VT_Empty 0 // Empty (Nothing)
OLE_VT_Null 1 // Null (Not used)
OLE_VT_I2 2 // 2-byte signed int (Short data type)
OLE_VT_I4 3 // 4-byte signed int (Integer data type)
OLE_VT_R4 4 // 4-byte real (Float data type)
OLE_VT_R8 5 // 8-byte real (Real data type)
OLE_VT_Cy 6 // Currency (Currency data type)
OLE_VT_Date 7 // DateTime (DateTime data type)
OLE_VT_Bstr 8 // Binary string (String data type)
OLE_VT_Dispatch 9 // IDispatch FAR* (LPDispatch data type)
OLE_VT_Error 10 // SCODE (OLEError data type)
OLE_VT_Bool 11 // Boolean (Boolean data type)
OLE_VT_Variant 12 // VARIANT (Variant data type)
OLE_VT_Unknown 13 // IUnknown FAR* (LPIUnknown data type)
OLE_VT_Decimal 14 // Decimal (Decimal data type)
OLE_VT_I1 16 // Signed char (Char data type)
OLE_VT_Ui1 17 // Unsigned char (UChar data type)
OLE_VT_Ui2 18 // 2-byte unsigned int (UShort data type)
OLE_VT_Ui4 19 // 4-byte unsigned int (UInteger data type)
OLE_VT_I8 20 // 8-byte signed int (BigInt data type)
OLE_VT_Void 24 // Void
OLE_VT_Hresult 25 // HRESULT (Integer data type)
OLE_VT_Record 36 // User defined type (Struct type)
Please note that it cannot tell what kind of user defined type.