LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
BoulderKen

"=-1?" and "<>-1?" functions in Comparison palette

Status: Duplicate

Several LabView functions return a -1 to indicate not-found/failure.  I often find myself creating boolean code snippets with the "equal to ----" or "unequal to ----" functions comparing things to a "-1" constant with the T/F output going to a case structure.  I thought it might be nice to have pre-made "=-1?" and/or "<>-1?" functions (similar to the "=0?" and "<>0?" ones) on the "Comparison" function palette to at least clean up the code a bit,

10 Comments
elset191
Active Participant

You can accomplish this particular use case easily using the <0

--
Tim Elsey
Certified LabVIEW Architect
BoulderKen
Member

Yeah that seems pretty obvious now. So maybe I should wait until AFTER my Monday coffee before posting ideas? 😉

crossrulz
Knight of NI

Plus this is actually a duplicate:http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Equal-1-function-to-be-added-to-the-Comparison-pallet/...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
BoulderKen
Member

Thanks, crossrulz - I must have missed that thread in my search, sorry.

Looks like they got the same responses - I would be okay if this was marked as "declined" as well since I could use the "<0" method.

SteenSchmidt
Trusted Enthusiast

If we could then just combine the <0 approach with this idea, then we'd be all the way there Smiley Wink

 

/Steen

CLA, CTA, CLED & LabVIEW Champion
crossrulz
Knight of NI

Steen,

 

You mean like just using the >=0 function?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
SteenSchmidt
Trusted Enthusiast

Argh, bad example there Smiley LOL

 

/Steen

CLA, CTA, CLED & LabVIEW Champion
MaryH
Member
Status changed to: Duplicate
 
TheQ
Active Participant
Why can't you wire the -1 right into the case structure? That is what I do. Then I have a -1 case and a Default case. Case structures can also have ranges as cases. For example ..-1 is the same as -Inf to -1. Or 0.. is 0 to +Inf. You can bound ranges too, 5..10 would be numbers between 5 and 10 inclusive. The caveat is that if you don't cover from -Inf to +Inf in your ranges you have to include a default case.
Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



BoulderKen
Member

Thanks, TheQ, that's a good point.  I sometimes use a case structure and sometimes use the "T/F" comparison function (I love that for doing simple "route this OR that based on True OR False" things without a big bulky case structure)