LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search 1D Array with first occurance

Solved!
Go to solution

Maybe I am not being clear. What I am after for is a wildcard search on the 1D array. After the characters are entered, like Eri, I want a wildcard search for any other characters after the initial characters are entered into the Search string control.

 


OK, so don't try my algorithm!  Yes, it's a bit more work, but you can also modify Crossrulz's Sequential Search by using some clever thinking and reading what you, yourself, wrote (quoted above -- "I want a wildcard search ...", so do a wildcard search!).  You'll need to think about how to better handle the "not found" condition, and also think what happens when you are looking for Zelda on a really long list of contacts (you'll have to search the entire list on every character you enter ...).

 

BS 

0 Kudos
Message 11 of 16
(1,282 Views)
Solution
Accepted by topic author Eric1977

I think I figured it out after just stepping back for a moment.

 

I had to use Subset Array along with the string length to compare against each element in the 1D array. Once I found a match using the Greater than Zero primitive, I just used the iteration terminal to feed the MultiColumn Listbox value.

 

Attached is a snippet in case anyone else needs to use this for a project.

 

 

1DArrayFirstOccurance.png

0 Kudos
Message 12 of 16
(1,277 Views)

One more question that relates to this. Since I can now select the row programmactically, how do I make the highlighted item visible without having to manually scroll up/down?

0 Kudos
Message 13 of 16
(1,257 Views)

I'm not sure what you mean by "make the highlighted item visible".  I've not worked with MCListboxes, myself, but I assume that you can set the Active Cell (the one you find programmatically) with the ActiveCell property.  Do you need something other than that?

 

BS

0 Kudos
Message 14 of 16
(1,246 Views)

What I meant was, when I find a match, the row becomes highlighted. The multicolumn listbox only has about 15 names visible to the user. If it goes beyond the visible selections, I want to force the multicolumn listbox to automaticlly scroll to the selection without the user doing this manually.

0 Kudos
Message 15 of 16
(1,233 Views)
Solution
Accepted by topic author Eric1977

There is a property called Top Left Visible Cell.  If you set that to the selected row, then your selected item will be at the top.


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
0 Kudos
Message 16 of 16
(1,227 Views)