I am new to ignition and SQL in general. I have been able to create the ignition dashboard that I need, but now I need to save data to a SQL database. I have a tag folder that holds all the tags I need to put into the SQL database (see below). I only need to put this data into SQL once a different tag changes from 0 to 1.
I am not sure exactly how to tackle this problem with my very limited SQL and Ignition knowledge. Do I need to write a script? Do I need to manually create a SQL table with a column for each tag? Or can ignition automatically do this for me?
So now that I have been watching it for a bit it isn’t triggering when the tag i am looking at changes. I was trying to mess with it by forcing the tag to 1, but that wasnt working. When I change the trigger to when the tag = 0 it works though. So I know that it is able to write to my SQL, just not when I need it to.
Are you sure you want Only evaluate when values have changed? If the values you're recording haven't changed, then the trigger won't cause them to be written.
Im pretty sure this is what I want. I am looking at a specific tag and once it changes I want to write my values to the SQL Table. I dont want them written UNLESS that tag has changed from a 0 to a 1
That option refers to the tags being written, not the trigger. And it overrides the trigger, meaning they won't write if they haven't changed.
The UI is confusing, because the tab name is "Trigger" but there's a specific option you're using for executing "on a trigger." When you don't use that, the trigger becomes a change in the values of one or more of the tags that are being written, if you have that option checked.
Someone else can correct me if I'm wrong about this, but I have used Transaction Groups in the past and that is my recollection of how it works.
That shouldn’t matter for my case because the tags get changed every cycle.
Either way, I unchecked that though and it still isn’t triggering.
A potential issue may be in my Execution scheduling, I have it for 1 second. Do you know if this means that it checks the tag every 1 second for a change?
That may be the case, I'm not sure, but it would explain why you don't always see the trigger happening if the trigger tag value goes back to 0 so quickly. If that's the case, you could create a secondary tag that is set to 1 when that one is (via change script), assign that as the trigger, and then use the Write handshake on success option to set it back to 0 when the trigger is invoked.
You definately do not want Only evaluate when values have changed checked. You are only interested in executing when the trigger tag has changed. If that option is checked then and only then will it look at the value of your trigger.
Not what you want.
Actually, it could matter, depending on what you have slected as the Tags to watch for change.
Assuming you are using the Timer option, 1 second means OPC tags are subscribed to at a 1 sec rate.
Its hard to tell what may be the issue may be from what you have showed us. I am assuming that you are using a basic transaction group, and that you have only OPC Group Items.
Tip:
On the Options tab, you should probably make certain that you have the OPC data mode set to Read. This will tell the trasaction group to first read the values at execution before continuing the execution and writing them to the database.