LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Prompt user for invalid data

Hi,

 

Is there any way to prompt user when he is passing the invalid data (out of range) at the same time while my application is in run state.

For example: serial no is  0-32 bit length, and as soon as user input data which is out of range while typing it should throw pop-up or warning such as "Enter valid serial no."

 

Vi is attached.

0 Kudos
Message 1 of 42
(4,617 Views)

You should use a numeric control and make the control datatype U32. Now the range is automatically correct and values outside the range cannot be entered. Now you can eliminate all your validation code.

 

(For other data types or ranges, you can set the valid range using the "right-click...data entry" option.)

0 Kudos
Message 2 of 42
(4,579 Views)

Actually valid data is string - alphanumeric.

 

Also, the requirement is to display pop-up or prompt users incase of invalid data entry.

 

 

 

Regards

Aniket

0 Kudos
Message 3 of 42
(4,565 Views)

So you actually have a 32 CHARACTER limit.  In that case, right-click on your string control and enable the "Update While Typing".  Now use an Event Structure with a Value Change event on that string control.  You will now get an event each time somebody types in that control.  From inside of that event case, you can do whatever checks you want on the string.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 42
(4,560 Views)

This sounds like a job for a regular expression A good test site is Here

 

But, of course, we can't help you build that regex without some knowledge about the rules of a valid serial number.

 

Expanding on crossrulz's idea the event driven prompt can be tweaked to discard illegal characters


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 42
(4,557 Views)

@aniketjha wrote:

Actually valid data is string - alphanumeric.

 


What does that mean?

 

In the diagram comments it says that "Serial Number is in range from 0 to 32 bit." and I based my answer on that. You can always format the numeric input into a string if this is needed later. Is the serial number entered in decimal or e.g. hexadecimal?

0 Kudos
Message 6 of 42
(4,555 Views)

When you say a string of alphanumeric, do you mean hexadecimal or ASCII? You can have (8) hexadecimal characters in 32-bits, but each 32-bit ASCII representation will be (4) characters with either the standard ASCII using 7-bits or using the extended ASCII which is 8-bits per character.  Some of the ASCII characters are unseen, but included in the string length.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 7 of 42
(4,547 Views)

Hi Altenbach,

 

Serial number is in ASCII format.

 

 

Regards

Aniket

0 Kudos
Message 8 of 42
(4,542 Views)

Hi Jeff,

 

Valid Serial Number is in ASCII format with max length of 32 bit.

 

 

Regards

Aniket 

0 Kudos
Message 9 of 42
(4,540 Views)

@aniketjha wrote:

 

Serial number is in ASCII format.

 


ASCII is not a format. It is an ecoding sheme to assign bit patterns to displayable or control characters.

 

Can you show us a few valid serial numbers? Would be much more illustrative than you trying to explain it in words.

0 Kudos
Message 10 of 42
(4,539 Views)