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
(769 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
0 Kudos
Message 2 of 10
(767 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
Semiconductor Validation & Production Test
Soliton Technologies
NI CLD, CTD
LabVIEW + TestStand + TestStand Semiconductor Module (2013 - 2020)
NI STS for Mixed signal and RF
Message 3 of 10
(759 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
(732 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
(696 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! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 10
(667 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
(655 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
(650 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
(628 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
(532 Views)