LYCIA
VARIANT is a data type intended to store values of different scalar data types. It is not a built-in 4gl data type - it was implemented specifically for Lycia and Lycia users. Variables defined as VARIANT take the type of a variable or a constant assigned to this VARIANT variable.
Full article about this data is available here:
Below you can find a simple 4GL application which demonstrates the VARIANT variable dynamically changing its data type.
4GL:
MAIN DEFINE var_char CHAR(40), var_datetime DATETIME YEAR TO FRACTION(5), var_integer INTEGER, var_variant VARIANT ##### VARIANT as CHAR ##### LET var_char = "abc" CALL my_func(var_char) RETURNING var_char DISPLAY "main: var_char = ", var_char ##### VARIANT as INT ##### CALL my_func(123) RETURNING var_integer DISPLAY "main: var_integer = ", var_integer ##### VARIANT as DATETIME ##### LET var_datetime = "9999-12-31 23:59:59.99999" CALL my_func(var_datetime)RETURNING var_datetime DISPLAY "main: var_datetime = ", var_datetime CALL fgl_getkey() END MAIN FUNCTION my_func(p_variant) DEFINE p_variant VARIANT DISPLAY "my_func(): p_variant is ", p_variant.gettypefullname() RETURN p_variant END FUNCTION
Please find below the link to our Gitlab repository which contains 4GL applications examples.
Follow instructions in this article in order to add the above-mentioned repository to your Lycia IDE.
Feel free to contact us in case if any additional information or assistance is needed.
Add Comment