ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Input over Barcode-Scanner

After read barcode with a scanner, testsequenz should be start.

I wanted to solve this with an event structure.
However, the comment “I'm here” is only displayed when I click next to the input field and the button focus remains on the input field “Labelcode”.

 

SeppR_0-1735915243504.png

 

0 Kudos
Message 1 of 6
(1,212 Views)

If the input string is terminated by a newline, right click on the string control an set Limit to single line.

If not, set Update value while typing instead; however, this way there is the risk to get a partial input.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 6
(1,193 Views)

An Event Case inside a Flat Sequence is just wrong on so many levels...

 

My Band-Aid would be to just poll the string control in a While Loop at 100mS intervals until it contained the proper number of characters in the right format to be a valid serial number.

 

But the real solution would be to start over with better code.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 6
(1,178 Views)

You may be able to program the barcode scanner to send a new line after the string, so Labview will get out of the event. 

0 Kudos
Message 4 of 6
(1,167 Views)

To expand on everyone's advice, remove everything on the block diagram and just add a string control. Then, right-click and select Limit to Single Line & '/" Codes display and see what you get.

 

 

Eric1977_0-1735928643929.png

 

Those barcode scanners might return a /r or /n (or both).

0 Kudos
Message 5 of 6
(1,155 Views)

@RTSLVU  ha scritto:

An Event Case inside a Flat Sequence is just wrong on so many levels...

 

My Band-Aid would be to just poll the string control in a While Loop at 100mS intervals until it contained the proper number of characters in the right format to be a valid serial number.

 

But the real solution would be to start over with better code.


I just assumed it was a prototypal code, essentially a proof-of-concept. But you are right, the code is ugly and it's difficult to add any further functionality.

In this very old post I attached a vi that can be useful. The original question was how to prevent a user to manually input a string in place of the barcode reader, however my vi can be easily modified in such a way to overcome the issue of receiving a partial string. This requires to enclose the event in a while loop, because it's necessary to manage multiple events.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 6
(1,130 Views)