Universal Robots Forum

Convert Variable to String

Hello guys,

i’d like to know if there is a way to convert the name of a Variable Objekt to a String.
In my case i’ve implemented a DropDownMenu like that one in example cyclecount…
Now i need to save the selected variable not only in the ProgramNode but also in the InstallationNode. But when i try to implement something similiar to the function in the programnode for saving the variable object in data model in the ProgramNode i got only a bunch of errors in PolyScope when trying to save the Program. So my idea is to save the Name of the Variable as a string, because saving Strings in the InstallationNode-DataModel works good for me even out of the ProgramNode while saving Variable Objects somehow only work in the ProgramNode but not in remote to the Installation Node.
The Reason why i need this is because the variable had to be set to a default value on program start otherwise the program like to malfunction somehow.

Hope you understand what I’m talking about.
Best regards Mathias

Ok never mind the second.
Got it myself, today isn’t my day i think.

The Object is convertabled with object.toString().
What i didn’t know is that it does not give back only a variable name but some other stuff as well (in my case a [PERSISTENT] was added to the name) and this gives me an error when telling the Installation Node to write to this variable.

Keep in mind, that Variables that are present in a Program may not be available to the Installation Node.
There may be multiple programs, that are using the same installation.
Hence, Installation Variables are accessible to any Program using this Installation.
But Program Variables are not accessible to the Installation - i-e- if you load another program, the installation node becomes unresolved since the variable is now missing.