01-03-2025 08:41 AM
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”.
01-03-2025 10:07 AM
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.
01-03-2025 11:12 AM - edited 01-03-2025 11:19 AM
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.
01-03-2025 12:02 PM
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.
01-03-2025 12:27 PM - edited 01-03-2025 12:28 PM
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.
Those barcode scanners might return a /r or /n (or both).
01-04-2025 01:46 AM
@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.