04-10-2018 11:27 AM
Hi
I am pretty new to labview and learning. I am trying to enter a number 003330 in a numeric control in my vi But it drops all the leading zeros. I cannot define this as a string as I will be passing this value from the output of the previous step in the teststand sequence which is Type: Number (dbl). Thanks for the suggestions.
Solved! Go to Solution.
04-10-2018 11:38 AM
The value of the number is going to be 3330 regardless of what formatting you have selected on your numeric control. There is no way to make the value remember the formatting of the control.
What kind of data is it? Why do you need the leading zeroes? Is the total length always the same, like a serial number?
04-10-2018 11:51 AM
Hi Greg
Thanks for immediate reply. This is a the data read from the scanner and it is a serial number with a fixed width. The data has been stored as a type: number in the stationglobals in the teststand which uses around 97 steps. I need this leading zeros as I am calling this number as the input to my vi to match the first digit with another number to identify the product and to validate the testing. The serial number will have different first digits starting from 0 - 3. Depending on the first digit it would be identified with different product. If you need any more information please let me now. Thanks.
04-10-2018 11:56 AM
Hmm... it definitely sounds like string or integer would be a better choice for the datatype, is someone tell you that you can't change it?
04-10-2018 12:00 PM
Yes, its been a number for a long time and its been used in the same data format in several other vi's in other steps. I am trying to find a way to read this number in my vi without disturbing other vi's and the whole test sequence.
04-10-2018 12:01 PM
You can format the double as an integer string. The "06" tells it to pad with zeroes to get the minimum width of 6 digits. This seems far from ideal because I assume different products could have different length serial numbers.
04-10-2018 12:07 PM
Yes you are right. Different product have different length serial numbers. The existing products have a length of 6.
04-10-2018 12:07 PM
Right click on your control, choose display format. Check the box for minimum field width and change it to pad with 0
04-10-2018 12:17 PM
I tried that, it added leading zeros in the numeric control display, but drops it in the block diagram when I want to use it for further comparisons.
04-10-2018 12:26 PM
The solution I provided will give you a string with the desired amount of padding on it.