Convert any into a string

ludecus
2022-04-11
2022-05-20
  • ludecus

    ludecus - 2022-04-11

    dear codesys colleagues,

    i looked for a function that converts the value of the any variable into a string. While i couldn't find a library or at least some documentations for this case, i written my own function.

    Hints or improvements are welcome!

     
    πŸ‘
    1
  • nothinrandom - 2022-05-20

    you should be able to call the generic TO_STRING() operator. For example, myString := TO_STRING(myDint);, where myString is a variable of type STRING and myDint is a variable of type DINT.

     
  • ludecus

    ludecus - 2022-05-20

    Thanks for your response.

    Unfortunately you misunderstood my needs.
    I was looking for a Function like ANY_TO_STRING not DINT_TO_STRING.
    As you can see in the attached project, the ANY-type needs to be decoded firstly in a IEC datatype.

     

Log in to post a comment.