11-24-2021 10:08 AM
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.
11-24-2021 10:13 AM
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.
11-24-2021 10:40 AM
My preference would be a slightly modified version of Paolo's just to avoid the error wire of Format into string.
In case you cannot use the snippet, here are the function labels.
11-24-2021 01:00 PM
@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.
11-25-2021 03:42 AM
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.
11-26-2021 09:51 AM
@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.
11-26-2021 01:51 PM
Returns TRUE if period, FALSE of comma.
11-26-2021 02:44 PM
@paul_cardinale wrote:
Returns TRUE if period, FALSE of comma.
Nice, but this is more efficient (no error handling):
11-27-2021 04:14 AM
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.
01-19-2022 02:44 AM
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: ?