AVEVA Community
AVEVA Community
  • Site
  • User
  • Site
  • Search
  • User
PDMS/E3D Forum
  • AVEVA World
PDMS/E3D Forum
Beginners Getting name of variable
  • Forums
  • Resources
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Replies 5 replies
  • Subscribers 1 subscriber
  • Views 62 views
  • Users 0 members are here
Options
  • Share
  • More
  • Cancel
Related

Getting name of variable

Lauri Lahtiranta
Lauri Lahtiranta over 5 years ago
 
  • Sign in to reply
  • Cancel
  • Lauri Lahtiranta
    Lauri Lahtiranta over 5 years ago
    Hi!

    Lets say I have a variable like !test = 'stuff'.
    How could get the name of that variable to lets say q var, so that I get the variable name out and not what it holds inside?
    In this case I want to get the test as result.

    Thanks for any help!
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • M Michal
    M Michal over 5 years ago
    Im not sure why u need that and how u planing use that, because for example u want to ask for name of variable !test, then u need ask for that variable like Q var !test, for result test? Why then just not typped 'test' staight?
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Lauri Lahtiranta
    Lauri Lahtiranta over 5 years ago
    Sometimes you either need to get the variable name in to an array/list/etc or process it later trough the name of the variable. Would be easier if i did not have to use nonstatic values but a modular self combining arrays/lists/etc.
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • M Michal
    M Michal over 5 years ago
    But still u need somehow identified that variable. So u need use that name anyway (or maybe number from list or array, but that should contain name of that variable)
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Lauri Lahtiranta
    Lauri Lahtiranta over 5 years ago
    I solved it, just but variables inside each other then call them with $ or not and you can get kinda c# nameof().
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel