ENUM strings

switcher
2015-07-07
2015-07-17
  • switcher - 2015-07-07

    Hi,

    I have a simple ENUM definition:

    TYPE Data :
    (
    Data1,
    Data2,
    Data3
    );
    END_TYPE
    

    Data1 is equal number 0, Data2 is equal number 1 etc...
    My question is:
    How can I get strings from ENUM data?
    For example - I like to get string Data1 in string variable (using number 0). Is it possible to get this in Codesys?

    Thank you!
    Best regards, Zdenko.

     
  • TimvH

    TimvH - 2015-07-17

    No this is not possible (or at least it was not possible when I last checked).

    What you could do is add text lists and place the text in these lists. From the application you can read these lists.
    See http://forum.codesys.com/viewtopic.php?f=11&t=5955

    The advantage is that you could translate these text lists for use in other languages.

     
  • switcher - 2015-07-17

    Thank you very much! This is helpful!

    Best regards,
    Zdenko.

     

Log in to post a comment.