How can we get the data type of a variable

Posted by Admin on 08-Jun-2010 23:51

For ex: When we define a variable based on preprocessor &if condition.

And in some part of the program I would like to know which data type of the variable is created.

Is it possible for us to know the data type of any variable at any point of time in Progress?

All Replies

Posted by Admin on 09-Jun-2010 00:39

No, but when you are working with include files and the preprocessor anyhow you might define additional preprocessor variables that indicate the data-type:

&GLOBAL-DEFINE variablexyz-datatype INTEGER

Then later

&IF "{&variablexyz-datatype}" EQ "INTEGER" &THEN

&ENDIF

Posted by Admin on 09-Jun-2010 01:21

Thanks for your swift reply Mike!

I just wanted to know if there is any Progress function to know the data type of a variable.

Posted by Admin on 09-Jun-2010 01:29

I just wanted to know if there is any Progress function to know the data type of a variable.

No, there isn't one.

Just for completeness, you might define a temp-table field like the variable and query the data-type oft he temp-table field.But the price for this is X-times higher than continuing with the proprocessor as suggested in my first post.

DEFINE VARIABLE cTest AS CHARACTER NO-UNDO.

DEFINE TEMP-TABLE ttTest NO-UNDO

FIELD Test LIKE cTest .

MESSAGE BUFFER ttTest:BUFFER-FIELD ("Test"):DATA-TYPE

VIEW-AS ALERT-BOX INFO BUTTONS OK.

This thread is closed