03-29-2022 08:21 AM - edited 03-29-2022 08:22 AM
I can't seem to get LabVIEW to keep the decimal point, it converts it to a comma.
I'm using 'Fract/Exp String To Number' with FALSE as using the system decimal point (LabVIEW documentation explicitly says that will produce a dot as decimal point). Note: my system is in fact using comma, but changing this has no effect. If I change the bool to TRUE it simply cuts off all decimals and returns an integer. Tried with both system decimal points.
See attached image for the simplest example you ever witnessed. Expected output is 1.1337, true output is 1,337
03-29-2022 08:36 AM
Hi Xisten,
@XistenZ wrote:
Expected output is 1.1337, true output is 1,337
Your expectation might be wrong... 😄
The numeric indicator will use the system numeric (regional) settings as long as you don't switch off that behaviour in the LabVIEW options. (Did you?) What is the numeric format of your computer/user account?
(Did you restart LabVIEW wen changing the regional settings of your user account?
03-29-2022 08:42 AM
The behaviour is expected, the True/False boolean tells the function whether to look for dot or comma in the input string and not in the output.
FYI, numeric data is stored as bits and it doesn't store anything about comma or dot, it is up to you how to display it when converted to a string. With this said, you have to update the Numeric Indicator's display format to use a dot instead of comma.
03-29-2022 08:45 AM - edited 03-29-2022 08:49 AM
@GerdW wrote:
Hi Xisten,
@XistenZ wrote:
Expected output is 1.1337, true output is 1,337
Your expectation might be wrong... 😄
The numeric indicator will use the system numeric (regional) settings as long as you don't switch off that behaviour in the LabVIEW options. (Did you?) What is the numeric format of your computer/user account?
(Did you restart LabVIEW wen changing the regional settings of your user account?
I think my expectation is reasonable 😅
As I said there's a boolean in that function to tell LabVIEW not to use the systems settings to force it to simply use a dot.
Changing the settings in either or both system and LabVIEW changes nothing in the behaviour. LabVIEW is a rebel that does not care as it seems.
03-29-2022 08:47 AM - edited 03-29-2022 08:48 AM
@santo_13 wrote:
The behaviour is expected, the True/False boolean tells the function whether to look for dot or comma in the input string and not in the output.
FYI, numeric data is stored as bits and it doesn't store anything about comma or dot, it is up to you how to display it when converted to a string. With this said, you have to update the Numeric Indicator's display format to use a dot instead of comma.
That explains it then, I assumed it was to convert the output. It also explains why it removes the decimals if I have it set incorrectly. Thanks!
03-29-2022 01:01 PM
The data is in the wire and formatting only plays a role when the value is presented to the user, e.g. via an indicator. It is up to the indicator how to do that.
While you probably want to decide globally how decimal delimiters are displayed, you could change the formatting of any single numeric (control or indicator) to use the nondefault delimiter.
In my case, the delimiter is a decimal point, but if I also want an indicator with a comma, I can use the advance formatting of the numeric indicator to force a comma as follows:
%,; force comma for the rest of the format string
%.; force period for the rest of the format string
%; force the default delimiter.
(look for the section about "Localization Codes" here)