<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Assign a value to a variable that is defined in a string</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/06076a7880/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/06076a7880/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/06076a7880/</id><updated>2023-02-13T22:34:24.294000Z</updated><subtitle>Recent posts to Assign a value to a variable that is defined in a string</subtitle><entry><title>Assign a value to a variable that is defined in a string</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/06076a7880/?limit=25#5562" rel="alternate"/><published>2023-02-13T22:34:24.294000Z</published><updated>2023-02-13T22:34:24.294000Z</updated><author><name>trevorb</name><uri>https://forge.codesys.com/u/trevorb/</uri></author><id>https://forge.codesys.come2485c9725ab91108bc8d77682ebbb2522430801</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;br/&gt;
I am using MQTT communication to send and recieve data. I subscribe to a topic and recieve a JSON Payload. The key corresponds to a variable on the controller and the value is the new value the variable is to be set to.&lt;/p&gt;
&lt;p&gt;My application may have 10, or 100, or maybe 1000 variables that need to be updatable from the UI.&lt;/p&gt;
&lt;p&gt;Is there a way to use the key (which is a string) as a reference to the variable that is to be updated so i can keep to code concise.&lt;/p&gt;
&lt;p&gt;Currently my only method of updating the value would be using a case select statement checking if the string value matches the tag. however this would need to be done for each tag.&lt;/p&gt;
&lt;p&gt;Any thoughts would be appreciated&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>