Using a UDT tag path in a parameter, possible to read a value from the UDT in script?

We’re using widgets on dashboards and trying to just have a sort of drag and drop interface where the user selects the tag they want to watch and everything is provided in the UDT, The label for the widget, The machine name, the value etc.

I have a perspective container that has a parameter on it of simply “tagpath”. When the user drops the widget on the screen there will be an edit screen come up and ask them which tag they want, so the idea is the user selects the “Press Performance” UDT. Inside the UDT we have a value just called “Label” that will be the label on the widget so I don’t have multiple users naming it all sorts of things like Efficiency, Performance, Status, Etc. In the label itself on the widget I’m trying to bind to that UDT parameter, and then read inside the UDT the memory tag that says “Press Performance” . This is what I’m trying at the moment:


Script that doesn’t work:

def transform(self, value, quality, timestamp):
	Transform the incoming value and return a result.

		self: A reference to the component this binding is configured on.
		value: The incoming value from the binding or the previous transform.
		quality: The quality code of the incoming value.
		timestamp: The timestamp of the incoming value as a java.util.Date
	return value

Any help would be greatly appreciated, thank you!

As is, your transform will return the incoming value (your tag path). Try something like this to read that path with “.Label” appended:

return system.tag.readBlocking([value + ".Label"])[0].value

Indirect tag bindings using the tag path should give better performance that doing this via scripting.


Thank you my friend!

1 Like

Also, an indirect tag binding for this is far easier to read