From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

trailing zeros programatically

Solved!
Go to solution

Is it possible to change the "Hide Trailing Zeros" property programmatically.

I realize that it can be easily changed statically in the development environment, but I would like to change them programatically based on a user selection.

 

Thanks

0 Kudos
Message 1 of 3
(2,773 Views)
Solution
Accepted by topic author jspaarg

Found it!

 

It's the Format String property

 

%.3f for 3 digits of precision and %.0f for no decimal places.

 

0 Kudos
Message 2 of 3
(2,768 Views)

Hi,

 

You can use this code to hide the trailing zeros:

 

%#.3f

 

This code will convert your number with 3 decimals but zeros will be truncated.

1.2345 will be converted to 1.234 and 1.2300 will be converted to 1.23

 

Best Regards

Svendsen

Message 3 of 3
(2,740 Views)