Dynamic Tag Path Issue

Working through the Ignition design challenge and struggling with the following. Attempting to change tag values from a popup window. I have a text box in the popup where you enter a value. Then I have a button that, upon clicking, writes the value you entered to the "brewType" tag. The code I have below is script from the button event configuration, and it worked just fine until I made the tag path dynamic. For example, when path = "[default]Brewing Tags/Station 2/brewType", it works just fine for changing station 2's brew type but only that station. Note, I have also tried making a custom property, binding it to the brewStation parameter, and using that instead of the parameter, that hasn't worked either. I have tested whether or not the parameter and the custom property are correctly receiving the numbers, and they are. But whenever I attempted this as shown below, nothing happens. Any advice?

def runAction(self, event):
	newval = self.getSibling("TextArea").props.text
	path = "[default]Brewing Tags/Station" + {self.view.params.brewStation} + "/brewType"
	system.tag.writeBlocking(path, newval)

How are you determining that nothing happens? Have you tried inspecting the output from writeBlocking? Have you confirmed that the tag path being created is the one you are looking for?

based on this, you are missing a space in your string.

Should be "[default]Brewing Tags/Station "

3 Likes