LabVIEW Developers Feature Brainstorming

Showing results for 
Search instead for 
Did you mean: 

Looking for user feedback on an If-Then-Else-If structure

I don't know is this is still up for debate, but...

Why don't you just have a normal case structure, which will allow you to pass an array or cluster of booleans.  If the array or cluster size is one, or if it is just a boolean and not an array or cluster, then the case structure functions as is.  If the size is greater than one, then the structure will adjust to contain n+1 many cases.  Again size equals 1 results in two cases, true/false.  In addition a cluster will allow the programmer to name the booleans, these names should show up in the selector lable box.  The last case, if there are more than one booleans, will always be else.  One more thing the porgrammer should be able to reorder tha cases as he or she sees fit.  Therefor if the title of the first boolean is Happy?, then it will show up in bthe selector as "1: Happy?" but the option would exist to make it "3: Happy?" or whatever integer, as long as it is less than the cluster size.

Message 11 of 14


Maybe you should Post an Idea at the Idea Exchange about an adaptive case statement that accepts a cluster.


0 Kudos
Message 12 of 14



If the cluster can be passed, as Broken Arrow suggested above to post in the Idea Exchange, I still don't get how the "true" condition will be decided in the first place.


The main issue is, how at a single point can we decide the condition to be satisfactory?

Execution is the next step, but decision is the first step and in your proposal I don't get how the decision making will take place. Can you please post an image / code for that? (I am using LV 8.6).



0 Kudos
Message 13 of 14

The problem with most of the structures i see here is the fact that whatever checks must occur for the if - else if - else if - else are actually calculated before hand. The goal is if a item check as true than there is no reason to keep checking. So I think the following is a nice way to do the IF - else if - else if - else structure. In the diagram below there is a equal number of cases in both case structures. As you can see if the first case fails it check the next condition, but if it passes the looping stops and the case associated with the same number is ran. The 4 default case should always be true. This is the else condition. And yes this isn't the best example but it works to get the idea across I think.if-Else-if.png

0 Kudos
Message 14 of 14