From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Printing sequential serial number on a label.

Hello everyone,

Thanks for looking at the post.

I need to print out serial numbers based on if a test passes or not and need the sequence of serial numbers revert back to zero and start again at the beginning of every day say 7:00 AM.

I have tried to use shift register and feedback nodes, however, unable to figure out how to reset the count based on the 7:00 AM condition.

Is there anything else that I should be trying?

Appreciate inputs on this.

Thank you

0 Kudos
Message 1 of 4
(2,744 Views)

You should probably store the current serial number in a file or a database, rather than a shift register.  What happens if your program or computer crashes or power is lost? 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 4
(2,736 Views)

Make a Cluster consisting of "Last Serial Number" and "Last Issue Timestamp".  When you go to issue a new Serial Number, check if the current TimeStamp and Last Issue TimeStamp span 7 am (i.e. Last Issue was before 7 am today, and it is now after 7 am), which is the condition to reset the Serial Number to 0 (or 1, or whatever you want to use), else you use the Last Serial Number to generate the current Serial Number, updating the Cluster.  The notion that you'd save the Cluster in a File is also a good idea -- simply open/write/close the file each time, and when you start the Program from scratch, open, read, initialize the Cluster, and close the file.

 

Bob Schor

0 Kudos
Message 3 of 4
(2,685 Views)

Seeing your code would help.

 

But the first thing I can think of would be to keep track of the "day of the year".

 

When the day of the year changes start checking the time, at 7:00 AM reset your serial number counter. 

 

I have to ask why 7:00 AM? Is that the start of a work day? Do your serial numbers include a date code? What if your company starts running 3 shifts a day?

 

It seems to me you would want to reset your serial number counter at Midnight. 

 

That also means you only have to watch the day of the year for changes to reset your serial number counter.

 

BTW: This is how you get the Day of Year...

tCapture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 4
(2,667 Views)