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: 
FranzS

"Search 1D Array" with "Found?" output

Status: New

The „Search 1D Array“ primitive should have a Boolean output “Found?”

 

 

4 Comments
FranzS
Member

Search002.png

altenbach
Knight of NI

That seems redundant to me. I most of my uses, the output is wired to a case structure (one case "-1" and the other "Default") so converting to a boolean is not necessary anyway.

 

(Alternatively, you could also suggest an error output that gives an error if no matching element was found, but I don't think we need that either).

AristosQueue (NI)
NI Employee (retired)

It's an ease of use thing to add that terminal. Since that's a primitive, if it were unwired, it could generate absolutely zero code and be identical to today's primitive. There's no technical reason not to do this and I can see a small improvement in diagram work (create a case structure for a Boolean is right by default; create a case structure for the index requires you to set up the pages of the case structure as "..-1" and "Defauld").

 

I'll add my kudos.

altenbach
Knight of NI

Well, if we decide to add more output terminals, i'd probably have more use for an "offset past match", which is the "index of element + 1".

It is needed if we need to find all occurences in a loop. Now that's a real "ease of use" thing. 😮 (related idea). Of course the problem is that is is easy to accidentally wire to the wrong output, causing incorrect results.

 

As I said, I am pretty happy with the limited current function. 😄