Get variable value by getting variable name from user input

Is it possible for me to prompt for variable name and then display the value of that variable. For example if I had the below variable in my app:

strName = “Joe Black”
strAddress=“123 Any Street”
strCity=“Some City”

If I use a Notifier to prompt for text and I enter ‘strName’ without the single quotes, can I have the program display the value of the variable strName with a Notifier?

Thank you for your help!

Hope this helps!

1 Like

I appreciate the help. I knew I could use if statements to check for the response. But I’m taking about having lots of variables and don’t want to have to do an if statement for each variable. It is for adding debugging to a very large and complicated program. If the user experiences a bug in the live program, I want them to be able to have the app display the value of any variable I choose so I can sort of debug the program in a live version of it. Didn’t know if there was a way of telling Kodular to take a string and evaluate it as a variable name.

Hmm… I really can’t think of any better ways right now. Maybe use functions and dictionaries? Like have a function that updates a list of the variables into a dictionary, then another you can use to fetch the variable?

I looked around some more, and I found a Dynamic Variables Extension. I believe this is basically what you’re looking for!

Thanks! Be reminded if you know how to use an dictionary, you can do so! My extension is just simplifying things :wink:

Thank you for your reply. The extension is definitely something I will use in the future. Unfortunately, my app has hundreds of variables that were created with the normal variable blocks, so it wouldn’t be possible to change all my variables to dynamic variable. But this would definitely be a solution if I didn’t have so many regular variable. I really appreciate your response and solution.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.