LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Decimal Symbol "," or "."

Good evening everyone.
I am looking for a way to be able to read the decimal symbol used in the computer settings via LabVIEW.

The parameter can be found in this path:

 

Panel Control --> Region --> Additional Settings --> Decimal Symbol: "," or "."

 

I've searched everywhere but haven't found a solution.

Thank you all very much for your help.

 

christiancolombi_0-1637769875074.png

 

0 Kudos
Message 1 of 10
(3,261 Views)

Certainly there are more elegant ways, but what I did so far is to Format Into String a 0.1 floating point value with %.1f format string, then take the second character in the resulting string.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 2 of 10
(3,259 Views)

My preference would be a slightly modified version of Paolo's just to avoid the error wire of Format into string.

DecimalSeparator.png

 

In case you cannot use the snippet, here are the function labels.

santo_13_0-1637772002557.png

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 3 of 10
(3,251 Views)

@Chricolomba wrote:

I am looking for a way to be able to read the decimal symbol used in the computer settings via LabVIEW.


 

This does not sound like a standalone quest. So, what problem are you actually trying to solve?

 

For example if you want to read tabular numeric data and the decimal delimiter is always ".", you can simply use e.g. "%.;%f" tor force region independent interpretation.

0 Kudos
Message 4 of 10
(3,224 Views)

Also note that you can tell LabVIEW (after a restart) to not use system decimals.

 

useLocaleDecimalPt=False in the ini file will tell LabVIEw to always use '.' as decimal separator.

 

There's an option for this in the options dialog as well, Options>Front Panel. I'm pretty sure it works on the diagram as well, so IMO this option should be in environment in stead.

 

I don't advice to use it, as the user preference should be respected. Also, peer programmer (or future you) might not have this option on and will be puzzled for sure. Installing (a new version of) LabVIEW will for instance not set this option by default.

 

The option can be a lifesaver if you got a LabVIEW application that was written by a less considerate programmer.

 

The option can also be great as a quick test to check if this is a problem in your own application. Obviously, a customer will be happy that it works with this hack, but if this option fixes a problem, you have a bug to fix. 

0 Kudos
Message 5 of 10
(3,188 Views)

@Chricolomba wrote:

I am looking for a way to be able to read the decimal symbol used in the computer settings via LabVIEW.

The parameter can be found in this path:

 

Panel Control --> Region --> Additional Settings --> Decimal Symbol: "," or "."


Connectivity -> Windows Registry Access VIs -> use Open/Read/Close functions.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 10
(3,159 Views)

rdx.png

 

Returns TRUE if period, FALSE of comma.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 7 of 10
(3,147 Views)

@paul_cardinale wrote:

rdx.png

 

Returns TRUE if period, FALSE of comma.


Nice, but this is more efficient (no error handling):

Detect comma.png

0 Kudos
Message 8 of 10
(3,142 Views)

you can use one of the solutions above or you call the Win API function GetLocaleInfoA or GetLocaleInfoEx (see example). But this solution is only available on windows systems.

Message 9 of 10
(3,120 Views)

Thank you very much, I like your solution.


Just a few questions:

 

How did you choose the values to connect to the inputs of the GetLocaleInfoA block?
With this method I could also get other parameters such as Measurement system: or Currency symbol: ?

0 Kudos
Message 10 of 10
(3,024 Views)