Table inserting double entries

Guys I have several transaction groups set up to record some barcodes. The setup is one OPC tag in the transaction group, I then have an expression tag setup in run always. The expression tag is used to trim off some characters at the start and the end. This expression tag has a target write to another tag.

I then have 2 tags setup in triggered expression pane, 1 tag that has a static location that never changes and the other is written from the expression tag above (barcode trimmed). This tag has a database target so I can capture the barcode to SQL.

I have an update of 1 second and I have checked the ‘only evaluate whe vales have changed’, set to look at the run always tag when it changes.

For the most it works but I do get double recordings in the database, I do think sometimes I am missing some barcodes that are being replaced by the last reading. It apears that the OPC tag is getting the value all the time but the result in table can be double reading.

Can the execution timing be out somehow? What do you think??

thanks

hazey

Couple of screen shots to help explain.

thx

hazey




Could you also upload a screencap of your trigger setup? :slight_smile:

As requested


The way the group is set up, it will log when there is a change in raw value coming in, even if it results in the same trimmed value.

I’d add a trigger using the trimmed barcode. That way the group is evaluated on a change in the raw value, but only logs if there is a change in the trimmed value.


Hi,

Jordan’s reply is on the right track, but unfortunately (for some strange reason) the group doesn’t like String data for the trigger (for the “Active on value change” option). I think it should suffice to simply select your “Barcode6_Aux” tag for the “Tags to watch” instead of the raw value.

If for some reason you need to get a bit more tricky, you could create a run-always item that was an expression, and use the “hasChanged” function to determine if the value had changed since last check, along with any other logic. If the expression ultimately ends up in a result of 0 or 1, you can just set the group to trigger on that, and get rid of the async trigger settings.

Regards,

Colby thanks. So when, in the execution cycle, does the information get written to the Database? After the expression has trimmed the extra data off?

Also the Barcode6_Aux is a string as well, does that matter?

Hazey

Hi,

Yes, since the expression item is set to write to the column, it’s the result of that expression (the trimmed value) that will be put in.

And I should have been a bit more clear: string values don’t work with the “Trigger on Item” settings, but they DO work with the “only evaluate when values have changed”. So, you can use the “custom” setting as you were before, and select the expression item.

Regards,

Guys I am still getting double entries in my transaction groups. Actually when I get a double entry I miss one entry. It misses the next entry and just doubles up the last value, only on random occasions.
I have taken Location_6 and Barcode6_Aux to the bottom pane (triggered) and have added a new boolean named Barcode6_Trigger that uses the hasChanged function. It is in the middle pane (run Always) and looks at Barcode6 in the top pane. I then set it to trigger on an item ie Barcode6_Trigger when it turns true.

This improved it a little but has not fixed the problem.

Any other ideas???

thanks

hazey

Did you just start getting double entries again? Was this issue resolved for a while back in Feb and the problem came back or are you just now getting back to working on this?

Dave no has been there all along.

I think I may have resolved the problem (I hope). If the scanner could not read barcode it is setup to send a ‘No READ’. This was triggering events and thus sending a double entry.

thx

hazey