取消
显示结果 
搜索替代 
您的意思是: 

Numeric Display Format for European Comma

I'd like to display a numeric indicator with a comma for the decimal point when used by European customers and a decimal point in the US.  The display format will be decided with a toggle and changed programatically. 
 
For example:  1.21 for US and 1,21 for Europe.
 
I only want to apply this to the indicators on the front panel (not when reading or writing files).
 
Is there a format/syntax that I'm missing in the indicator properties?  I tried the "%,;" syntax, but it bounced.
 
Any help is appreciated.
0 项奖励
1 条消息(共 12 条)
5,971 次查看
Hi SJT,
you can use a string indicator.
Mike
0 项奖励
2 条消息(共 12 条)
5,970 次查看


@SJT wrote:

Is there a format/syntax that I'm missing in the indicator properties?  I tried the "%,;" syntax, but it bounced.
 
Any help is appreciated.


After the %,; you should append the normal formatter, like %f or %d.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 项奖励
3 条消息(共 12 条)
5,968 次查看
Thanks for the quick responses.  I'll be more specific by uploading sample code.  This code does not actually work and creates an error. 
0 项奖励
4 条消息(共 12 条)
5,964 次查看
What is the localized setting on your PC?
0 项奖励
5 条消息(共 12 条)
5,951 次查看

If you can use a string indicator as Mike suggested, then see the attached example which shows a couple of ways of accomplishing this.  They both do the same.

This method will not be affectd by the localization setting on your PC.

RayR

 



Message Edited by JoeLabView on 06-28-2008 09:20 AM
0 项奖励
6 条消息(共 12 条)
5,949 次查看

Joe,

The settings on the PCs will vary depending who installs the program:  some in US, some in Europe.

I'd like to avoid converting to strings, if possible.  So I'm holding out for a property node change on the numeric indicator itself.  If there's no simple solution that I'm missing, I'll go to more elaborate solutions. 

Any more advice??

0 项奖励
7 条消息(共 12 条)
5,945 次查看
By default, all numeric indicator and controls automatically display with the correct localized settings, so there is really nothing to do.
 
The corresponding LabVIEW.ini setting is:
 
useLocaleDecimalPt=True
 
(and is assumed to be TRUE if missing).
 
If your program is installed on a German computer, it will show a comma and if it is installed on a US computer it with show a decimal point. What else do you want? 🙂
0 项奖励
8 条消息(共 12 条)
5,928 次查看

OK.  That would be great.  Do the local settings only apply to front panel display indicators or will it affect how data is written to an Access database, Excel and other text files?

Thanks for your help.

 

0 项奖励
9 条消息(共 12 条)
5,909 次查看
I would think that excel and databases use localized settings but LabVIEW has no control over this. The underlying data is the same and the display is just a cosmetic property implemented by the program that displays the values.
 
LabVIEW does have control over how formatted text files are written (and that includes text files and  "spreadsheet" files). This will cause a problem if for example files are exchanged between computers with different localized settings. I would strongly recommend not to use localization for formatted text files. Still, you can overwrite the default behavior by changing to the "other" seperator. To write a spreadsheet file in the US with a comma as decimal sperator, use a format of "%,;%.3f" for example.
0 项奖励
10 条消息(共 12 条)
5,902 次查看