readBlocking
always returns a list of QualifiedValues
.
writeBlocking
will accept a QualifiedValue
.
Probably also want to filter initialChange
readBlocking
always returns a list of QualifiedValues
.
writeBlocking
will accept a QualifiedValue
.
Probably also want to filter initialChange
Hmm, at this point I'd just throw out all assumptions and build this up slowly. Try one line of code that writes a static value to a full tag path. If that works, write it to an indirect tag path. If that works, add an if statement, etc. When a step doesn't work, you should have an idea of what's going wrong.
I'm wondering if the if statement is evaluating to false. Can't check that on my end, but I tried building a similar setup from the information I see here and it seems to be working fine.
This is the Value Changed script on ReadTag:
def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
value = system.tag.readBlocking("[.]ReadTag")
system.tag.writeBlocking("[.]Folder/WriteTag", value)
[~]
means "change tag's tag provider". To use relative referencing you should be using [.]
https://docs.inductiveautomation.com/display/DOC81/Tag+Paths
Edit: perhaps I missed that you'd already changed this...
the only difference I see with what it it that I am using a tag external to the UDT where as yours is all internal the the UDT. I will try something like that.
So I have found that if my IF or whatever I want to use is in the UDT it executes but if I use anything that exists outside of the UDT it doesnt execute. I can make that work, I think.
Thank for the help guys!
Glad you're making progress, though you should be able to reference outside tags if you want to.
I created an AlwaysTrue tag in the same root directory as the UDT instance and can access it no problem.
def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
if system.tag.readBlocking("[.]../AlwaysTrue")[0].value:
value = system.tag.readBlocking("[.]ReadTag")
system.tag.writeBlocking("[.]Folder/WriteTag", value)
It also works when I use an absolute path.
if system.tag.readBlocking("[Sample_Tags]AlwaysTrue")[0].value: