LabVIEW Idea Exchange

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

Warning case in Error/No error case structure

Status: New

Hi.

 

I simply propose to add a Warning case in the automatically generated Error/No error case structure:

 

Warning.png

 

The inclusion of the Warning case could be optional, and maybe setup by right-clicking the case structure?

 

Cheers,

Steen

CLA, CTA, CLED & LabVIEW Champion
8 Comments
Gleichman
Member

You're not asking for a change in the case structure, but a change in the error cluster. The internal control of the error cluster that set error/no error is a Boolean. Last time I checked there wasn't a tri-state Boolean Smiley Happy

David S.
NI Employee (retired)

I think -- and I'm not in R&D, so this isn't certain -- the reason that doesn't already exist is that there's no standard way to signal a warning. A lot of developers will use the condition of status = False and code != 0, but that isn't canon. NI would have to define a specific configuration of the cluster for warnings, and that would have a backward ripple efffect through old code.

David Staab, CLA
Staff Systems Engineer
National Instruments
SteenSchmidt
Trusted Enthusiast

Status = False and code != 0 is exactly the differentiator of the "Explain Error"/"Explain Warning" text when you right-click an error cluster indicator. Also look at this reply:

 

http://digital.ni.com/public.nsf/allkb/A5FBE856130518AF862570F4007D8761

 

Of course you could have several different ways to discern between warnings and errors, but the one above has been the accepted one among the LabVIEW programmers I know, in all the years I've been programming LabVIEW. I have never heard it disputed before, so I'd be quite interested if someone from NI R&D could tell us if this isn't the case?

 

Cheers,

Steen

CLA, CTA, CLED & LabVIEW Champion
AristosQueue (NI)
NI Employee (retired)

Steen has it correct. Status = False and code != 0 means warning. Used through out NI APIs, goes all the way back to the original creation of the error code cluster.

altenbach
Knight of NI

> The inclusion of the Warning case could be optional, and maybe setup by right-clicking the case structure?

 

  1. Yes, it should by default behave exactly as it does now: two cases: error, no error.
  2. We can use the existing right click options "add case before|after, duplicate case, etc.) to generate the warning case.
  3. We should also have a menu option "Add case for every value" which would also simply add a warning case. 
  4.  errorno error, warning.
  5. Since in point 1 we now have an under-determined situation, the "no error" case should be defined as "default" to retain the current behavior and should be labeled as follows:  errorno error (default).
  6. We should be free to assign the default to the error case in order to handle warning and errors specially in one case: error(default)no error.
dthor
Active Participant

Would it be a good idea to combine this idea with the principal behind this one? (http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Error-code-case-selector/idi-p/967725) For the record, I don't like the right-click-to-choose-input-method that the Idea I linked mentions.

 

The idea:

A case structure that, when an an error cluster is wired to the input, by default acts as it does now (2010SP1). However, a user would be able to right click and add a generic warning case. Then the user could add *another* case, and give it a specific error code for a warning or error. I think this would be relatively easy for NI to implement, and it could greatly reduce the need for nested case structures and unbundle nodes.

 

Here's the structure I imagine:

Case:                              Executes when:

no error (default)            Status == False and Code == 0

error (generic)                Status == True and Code != 0 (and not defined in other cases)

warning (generic)           Status == False and Code != 0 (and not defined in other cases)

Code 54                           Status == False and Code == 54

Code 3290                       Status == True and Code == 3290

Error Code 1                   Status == True and Code == 1

Warning Code 1             Status == False and Code == 1

Code 2                            Status == anything and Code = 2 (obviously this one would cause a broken VI if it was defined and "Error code 2" was also defined)


 

I think that this would cover all the basis very thoroughly, while still providing the simple Error/No Error functionality of the original case structure.

 

Also, thanks to altenbach for the idea of color-coding my reply Smiley Wink

 

EDIT: formatting

Edit 2: Added "Code 2" case

SteenSchmidt
Trusted Enthusiast

Yes, I also thought about being able to specify specific error codes, I just didn't have a good suggestion how to keep it uncluttered. The current Error/No error, and possibly with an added Warning, case structure is so clean it would almost be a shame to ruin it. But the first thing that almost always happen inside the Error case is a nested case selecting on "code". But be very careful about the implementation if you go for specific codes - sometimes less is more Smiley Happy

 

Cheers,

Steen

CLA, CTA, CLED & LabVIEW Champion
Darin.K
Trusted Enthusiast

Cases like this with multiple AND'ed conditions led me to suggest Multiple Case Selectors.

 

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Allow-Multiple-Case-Selectors/idi-p/1301780

 

This application is right in its wheelhouse.