I’m new to Ignition so hoping to get some assistance with something that seems like it should be possible. I’m experimenting with a Derived Tag. I would like to compare the value of two tags, if they do not meet my requirements I would like to increment the value of a memory tag.
Thanks for the reply! I had tried using a Tag Event Script but I it wouldn’t update the tag. Checking the log, it would give a valueChanged NameError: and say the tag doesn’t exist.
I created an expression tag and it would update itself correctly, but this is where I had the Tag Event Script and it didn’t work.
I’ll try the gate timer script to see if I can make headway with hit. I liked the idea of the tag though.
From the Script Console I can enter the following and it works but not from a Gateway Tag Script. I tried the square brackets but it wouldn’t work in either window.
Gateway-scoped scripts need fully-qualified paths; they don’t know what realtime tag provider to execute reads/writes against. So system.tag.read("SizingSaw/Counter") would become system.tag.read("[default]SizingSaw/Counter") in a gateway script.
This isn't an expression, that syntax for reading the value doesn't do anything. You're trying to write a String value with '1' concatenated to the end of it.
If you want to increment the value of a tag read the value first using system.tag.readBlocking before you increment and write it again.
When I look at this:
I am understanding that the qv variable begins to exist in the first line.
The system.tag.readBlocking is reading the value of the tag called Test.
The brackets that are square differentiate the value of the tag vs it being a string?
I am totally confused by the
[0]
on the end of the first line.
Second line, why is .value used?
Would
qv+1
not work?
I don’t have questions about the last line.
Thanks for helping me.
I program in a few languages, and it seems to be hindering me haha
Because readBlocking accepts a list of tag paths and returns a list of QualifiedValues, corresponding in length and position with those tag paths.
This is because of what I mentioned above about it returning a list of QualifiedValue, which is an object with value, timestamp, and quality components. You need to get the value out of it to actually increment.
I have written this.
It does not change the values of either New Tag or New Tag2.
When I designate the tag, I click on the tag icon, then find the tag to insert.
[.]
is automatically written as part of the tag.
I noticed your code did not have [.]
I noticed in other versions, code reads like [Default]“Tag” rather than [.]“Tag”
Is that part wrong in my code?
I looked at both links, and tried a few ways to fix my code. I am still trying things till I hear back too.
Thank you for helping me. If there is any training I might have missed, I will review it.
I am watching the videos too to see if I missed it.