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 Idea Exchange

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

Expression nodes that allow comparisons

Status: Declined

Any idea that has received less than 3 kudos within 3 years after posting will be automatically declined.

Allow comparison operators in expression nodes.  Input could be numeric or string, output would be boolean.

New Expr.png

"If you weren't supposed to push it, it wouldn't be a button."
6 Comments
RavensFan
Knight of NI

Why would you need this?  What is the benefit over normal LabVIEW comparison functions?

paul_cardinale
Trusted Enthusiast

We don't really "need" any expression nodes at all.  But they can make our BDs cleaner.

For example, I would code x + 10 as:

xp10a.png

 

not  as:

xp10b.png

"If you weren't supposed to push it, it wouldn't be a button."
RavensFan
Knight of NI

But expression nodes are quite a bit slower.

AristosQueue (NI)
NI Employee (retired)

> But they can make our BDs cleaner.

 

That's a matter of opinion. I happen to disagree. I find most math notation fairly distasteful to try to read. I mean, I have the skill, and I *can* do it for all sorts of arcane things, but even that basic notation there is less clear to me than the graphical notation of values going to operators. As I said, opinions vary. There are people who like writing whole applications in text. I prefer not to whenever possible.

X.
Trusted Enthusiast
Trusted Enthusiast

I personally much prefer this:

 

Screen Shot 2016-01-30 at 11.20.08.png

 

even though a dummy input is required (0 here, but obviously anything would work just fine), compared to that:

 

Screen Shot 2016-01-30 at 11.20.13.png

 

but it is true that my opinion is of little value, since I have to deal with this kind of formula on a regular basis...

I wonder what the Help for this node has in mind when it refers to "complicated" expressions:

 

Screen Shot 2016-01-30 at 11.26.58.png

 

Irony aside, regarding your proposal, you already have something  quite close with this:

 

Screen Shot 2016-01-30 at 11.31.09.png

 

The Expression Node in fact supports  (almost) all operators supported in the Formula Node, so there is quite some choice.

The problem you would have is that the "=" operator is an assignment operator in the syntax of the Formula/Expression Nodes, but isn't supported in the Expression Node (because it only supports one single variable). Forcing it to have a different meaning in the Expression Node would be confusing.

This being settled, how would you tell the node that you want a Boolean output rather than the natural numeric one? Some contextual menu option? I would argue that this is more pain than I would be willing to deal with.

 

Moreover, the syntax above also works with arrays:

 

Screen Shot 2016-01-30 at 11.34.01.png

 

 and clusters as well:

 

Screen Shot 2016-01-30 at 11.37.24.png

 

How would your new proposal handle this? Output a single value? An array, a cluster?

 

Strings? Seriously? It is my understanding that using strings is not recommended in LabVIEW...

Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 3 kudos within 3 years after posting will be automatically declined.