LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with the system decimal point with german regional settings

I have a Labview 6 app that needs deploying to Germany.

My app sends strings over VISA RS232 and GPIB instruments with floating point numbers.

When changing from English to German regional settings, in Windows XP, periods are now interpreted as commas and the app starts truncating my decimal numbers. So in the English Regional Setting when I send 1.234 I get 1.234 but in the German Regional Settings when I send 1.234 I get 1.000.

I have turned off the "Use localized decimal point" in Tools - Options - Front Panel as well as set any function (Frac/Exp String to Number) that has a "Use System Decimal Point" connector to FALSE.

Now here's my problem....

This fixed the issue I was having as long as I am in the development environment, however, once I build the application I still get the truncated numbers. Example: I send 1.234 to an instrument and it sees 1.000.

Again this works fine in the development enviroment, sending 1.234 reads 1.234 with German regional settings.

Any help is appreciated.

Adam
0 Kudos
Message 1 of 11
(10,253 Views)
You can use a simple function of the "Scan from string" function.

Place "%.;" (Without the quotes) in the scanning string, and this will tell LV to use a decimal point for interpretation. If you place "%,;", this will tell it to use a comma.

You can place this at the beginning of your format string, and it simply tells the parser how to work, it doesn't otherwise produce an output.

Using simply "%;" sets the seperator to the system default (maybe the best idea after the code has been run as the changed decimal point character apparently remains changed otherwise). From the LV help

"
The following codes control the decimal separator used for numeric output. These codes do not cause any input or output to occur. They change the decimal separator for all further inputs/outputs until the next %; is found.

%,; comma decimal separator
%.; period decimal separator
%; system default separator
"

Hope this helps

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
Message 2 of 11
(10,246 Views)
I have this type of syntax in the format string that I am sending out the port "%.". So this does not work. Again in the development enviroment everything works fine only when I go to the exe does the program cease to function properly.
0 Kudos
Message 3 of 11
(10,242 Views)
Make sure you are not forgetting the semi colon ";" in the text, otherwise it won't work.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 4 of 11
(10,234 Views)

@ABerryhill wrote:
...I have turned off the "Use localized decimal point" in Tools - Options - Front Panel ...hr>



Unchecking the option "Use Localized Decimal Point" creates an entry "useLocaleDecimalPt=False" in Labview.ini.
Check in your built application's ini file whether there is such an entry (if the app is named "app.exe", there should be a file named "app.ini" in the same directory after the first run of app.exe).
0 Kudos
Message 5 of 11
(10,226 Views)
"I have turned off the "Use localized decimal point" in Tools - Options - Front Panel … This fixed the issue I was having as long as I am in the development environment … Again this works fine in the development environment."

Adam,

You need to add the following key to your exe's .ini file for the local decimal pt option to be off in the executable:

useLocaleDecimalPt=False

Fuller discussions and encountered pitfalls are in the following links:

http://forums.ni.com/ni/board/message?board.id=170&message.id=13383
http://forums.ni.com/ni/board/message?board.id=170&message.id=70534
=====================================================
Fading out. " ... J. Arthur Rank on gong."
Message 6 of 11
(10,224 Views)
Thanks everyone,

Adding the useLocaleDecimalPt=False in the app.ini fixed the problem.

You would think the app builder would automatically add this since you specified it in the development environment.

Thanks again,

Adam
0 Kudos
Message 7 of 11
(10,224 Views)
Does this mean that the "%.;" usage only works if the regional decimal point is turned off?

I did not know that. Something new learned.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 8 of 11
(10,204 Views)
No the development environment options are not exported to the build application. You have to provide an appropriate ini file and include it as a support file. The safe way when communicating with an instrument is to always use the decimal specifier explicitely "%.;" to format/scan strings. Your VIs then become independant of the system/application settings for the decimal separator. You can allow the user to set his/her own display preferences without affecting your VIs.


LabVIEW, C'est LabVIEW

0 Kudos
Message 9 of 11
(10,194 Views)
In principle this is correct. But if you don't write your own Vis but use driver libraries (from NI or from the instrument's manufacturer or any other source) you wouldn't like to add the "%.;" in all the conversions in those VIs, would you?
0 Kudos
Message 10 of 11
(10,177 Views)