LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
SteveChandler

Enter Equation In Numeric

Status: New

I would like the ability to enter simple equations in numeric controls and constants. Pressing return places the answer in the control or constant.

 

Smart Numerics.png

=====================
LabVIEW 2012


17 Comments
altenbach
Knight of NI

Numerics have a good filter to validate only legal input, so this would need to be relaxed to allow other characters and validate entire expressions. What should happen if an expression is invalid? Should it still fire a value changed event? Probably not.

 

Still, I agree it could be useful. An extension of the idea would be to allow certain special constants, such as typing "pi", "2pi" or "pi/2", etc.

Darin.K
Trusted Enthusiast

Why not make the input of the Expression Node optional or removable?  You can enter pi or pi/2 or 1/3, it would remain self-documenting and the compiler could determine the value so there shouldn't be a runtime hit.

altenbach
Knight of NI

Darin: If we are allowed to enter expressions into a control at run time, the evaluation cannot be done at compile time. Maybe I am misunderstanding what you are trying to say.

Darin.K
Trusted Enthusiast

On my phone I missed the controls part, just saw the constants.  I just don't feel a strong urge to use this in a control, but I am old fashioned and do the math in my head and know at least 6 sig figs for all constants that I use.

 

For constants it would be great, I want all of those 3's in 1/3 and all of those digits in 2pi, and I would love to see 1/3 instead of 0.33333333333333333333.  The Expression Node with no inputs would give me everything I need. 

Lavezza
Active Participant

Some languages (like Common Lisp) support ratio's as a numerica type. I don't have a use for this, but I'd like to see LabVIEW grow to support it.

SteveChandler
Trusted Enthusiast

Altenbach, for an invalid expression maybe the system could beep and return the value of the control to whatever it was before. Definitely should not fire a value changed event. Maybe an "invalid value" event but that is an idea that can be saved for if this one is implemented.

 

Maybe this could even be a property that defaults to off so that LabVIEW behaves as it does today until this is explicitly enabled.

=====================
LabVIEW 2012


Dragis
Active Participant

I like this idea in general, but I would probably expect the control to keep the equation instead of calculating the value and replacing it when you hit enter. Knowing that the user wanted 1/3 instead of .333333 could be useful, especially if you change the data type in the future from one numeric type to another. Plus, 1/3, is just easier to understand and is self documenting. Same goes for more complex expressions. 

 

The Expression Node should certainly be updated to allow constant expressions if it doesn't already do that today.

SteveChandler
Trusted Enthusiast

Dragis, that is a really good suggestion. Maybe this could be selectable with a property.

=====================
LabVIEW 2012


Ray.R
Knight of NI

How about a new numeric control to support this feature?  Overloading an existing control may lead to abuse..

A control that would be something like an Expression Node, for instance (without the input, of course).

 

SteveChandler
Trusted Enthusiast
I wouldn't mind a new control so much. But I would like to see constants support this over controls. I don't think it is necessary to make controls and constants as powerful as a scientific calculator.
=====================
LabVIEW 2012