LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I conditional format a numeric control?

I would like to alter a control's or indicator's format based on the entered or displayed value. For instance, if the value is >10 use %.0f, otherwise use %.1f.

I am controlling a process that drives a value to 0, and want to increase the significant digits as I approach 0. Is there such a thing as a conditional format specifier?

This is a Real-Time application, so I would like to avoid property nodes in a while or timed loop if possible (they force FP update).
__________________________________
Laine
0 Kudos
Message 1 of 5
(3,654 Views)
hi there

ok, RT app. that's something different..

there are properties for the format specifier of numeric indicators, but you can format the number to a string using a value dependent format specifier and then display the string on your FP (no FP updates required). if yo reread the value of the number with locals then hide the numeric indicator and show a copy of the data on the string indicator (you even can include units in the format specifier for better display).

one can say "don't play with dynamic data in RT apps", but i think this is acceptable in this case.

best regards
chris
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 2 of 5
(3,654 Views)
Yes, RT can be tricky w/memory management worries.
Your method uses local variables, another no-no in RT.

I am now using a case structure (tests value>10) in my communication loop (not time-critical) with two property nodes, format str=%.0f (true) and format str=%.1f (false)

But I am still interested in conditional formatting within the format specifier string. This practice is common in pgms like MS Excel, in which you can format font color based on value (black for positive, red for negative) directly in the specifier.

But I don't think this is available in LabVIEW. To where do we make suggestions for future program improvements?
__________________________________
Laine
0 Kudos
Message 3 of 5
(3,654 Views)
The Product Suggestion Center on NI's web site is at
http://digital.ni.com/applications/psc.nsf/default?OpenForm&temp1=&node=

If that does not work search NI's site for "Product Suggestion Center".

Can you use queues to pass the data insteda of local variables?

Lynn
0 Kudos
Message 4 of 5
(3,654 Views)
Thanks, I have suggested.

Yes, to avoid memory management hassle, I could use RTFIFOs, but this creates code headaches also. I just want the conditional format directly in the specifier.

Thanks for your suggestion!

L
__________________________________
Laine
0 Kudos
Message 5 of 5
(3,654 Views)