How to create a tag that updates with each query refresh (adds the value to the next)

Here's what I am trying to do:
1: scan a barcode in to a text field and using an SQL query look up the TIME column relating to that barcode & return the value in to a text box (this I can do no problem)
2: I then want to store that time in to a vision clientTag or something so that I can scan the next item
3: I then want another vision client tag or similar to take the value of the stored tag and the value of the new tag and add them together.

What I want to achieve is user can scan a stack of barcoded paperwork conseculativly and it will then display the total number of mins that have been scanned.

I toyed with the idea of having a SQL query that grows and adds each scan to the query to get the result but then hit walls as I'm not very good at this

My SQL table looks like this :
[ID]
,[DATE_TIME_STAMP]
,[CutTicket]
,[LayMins]

The values I am pulling are [CutTicket] - the barcode I scan as a string
[LayMins] the time allocated for each ticket.

How would you guys and gals go about having a vision client screen that enables the user to scan the barcode string and then creates a running total . (with maybe a clear button for when the running total is to be reset?)

Jon

Becareful of the scope of the things you are summing up. Clienttag is per user/pc while sql is not (unless you add in a user column). But if you dont, than two clients scanning things would mix up the totals...

Thanks in this solution the summary would be unique to each client - it is not to be stored anywhere etc. just for the user logged in to the client to physically scan the stack of papers in front of him and it will add up the total time that this should take.
once finished the data is not stored etc its just a visual calculator for that specific instance.
hence going for a client tag idea so that it would all be kept local.

reality is that it is likely only to be used by one user at a time as well.

Thanks for the guidance though! it is appreciated :slight_smile:

You will want to script the construction of your dataset in the script that the runs your query. You can use system.dataset.addRow() to attach the row extracted from your new result to the prior dataset held locally. Then loop through the new dataset to get the sum you wish. Write both new dataset and summed minutes to window properties to your client tags.

1 Like