05-22-2026 06:25 AM
I have products with different references such as A1, A2, A3, etc. I scan these references using a Zebra scanner.
I would like to create a counter that ignores any reference that has already been scanned.
Does anyone have an idea, please?
05-22-2026 10:32 AM - edited 05-23-2026 11:16 AM
We cannot debug picture. Overlapping wires and structures, no indication what you mean by "references", local variables where we have no idea where the terminal is. A feedback node that makes no sense, etc.
Please attach your VI, give some reasonable inputs. typically placing items in a "set" would be easiest to tell if an item already exists.
05-24-2026 02:33 PM
You recently posted about problems installing LabVIEW 2021. If you were successful, and your code uses LabVIEW 2021, then please submit your code using that version. Note that experienced LabVIEW developers probably have not (yet) installed the latest version of LabVIEW, and won't be able to open code saved (for example) using LabVIEW 2026.
Bob Schor
05-25-2026 01:40 AM - edited 05-25-2026 01:46 AM
Hello everyone,
thank you for your replies. I have just attached my .vi file, please.
I am using LabVIEW 2021 (64-bit).
05-25-2026 03:54 AM
My program compares each scanned reference with the previously scanned reference. If the current reference is different from the previous one, the counter is incremented by 1; otherwise, no action is taken.
I also want the counter to be saved when exiting the while loop, as this persistence step is currently not implemented.
05-25-2026 08:07 AM
You are in the right direction. you latest vi is like a buffer. it increments whenever the two conditions are met, the new scan is different from zero and it is different from the previous.
However, it will compare only with the latest scan included. If you need to compare with all the previous scans you need to use an array (like what you used in the first image.
Use this COUNTREF_With Iteration.vi to be called from the main vi
I included a control Iteration that you can wire from the main loop, this way, when iteration is 0 (first time the vi is called, it initializes the shift register).
I included an image of the counter with iteration being called from your main vi. (There is more to be added from your logic).
05-25-2026 09:45 AM
Hello ROtake,
Thank you for your reply.
I need to integrate this logic into a state machine, at the end of my test when the product reference is validated.
However, I think the method I used may not be the most suitable one.
The objective is to check whether a reference has already been scanned or not.
Therefore, I think it would be better to store all scanned references in an array, and then check within this array whether the reference already exists before performing the counting or processing.