Searching an item from a list into another list


Well, I’m facing the following situation: I get from my database, data like this:


I have a Spinner where I have to put just one info, like AAAAAAAA.

What I need is, when I choose an item from the spinner, it must store its relative data to variables, I mean:

If I choose BBBBBBBB, all the rest (8 and ZZZZZZZZZZ) must be put into variables. The same thing is when I choose another item from the Spinner.

I already know that I must have 2 lists. But how to retrieve all data from the second list, based on my choose on the first list (Spinner)?



Can you show us some blocks of what have you tried???


Yse, sure!

Here I create the two lists:


As you can see, the list lista has just one item, but the list lista_veiculos has 3 items.

Here I was trying to catch what was choosen in the spinner:


So, my question is: how to catch the item from the second list, based on the item chosen in the spinner?


I think the problem is that the 2nd list only has 1 item, because you are joining everything in one single string.


But that’s the idea. Look: Let me explain better:

List lista: AAAAAAAA
BBBBBBBB (this is going to be shown in the Spinner).

List lista_veiculos: AAAAAAAA, 2, XXXXXXXXXX

When I choose BBBBBBBB in the Spinner, I have to get ALL data from the list lista_veiculos, I mean: BBBBBBBB, 8, ZZZZZZZZZZZ.

It’s like a search, when I choose an item from the 1st list, I have to find it on the 2nd list…


Maybe you can append the lists together after selecting an option in the spinner


I believe this would work:


The problem is that the list lista is the basis of the spinner…


hmmm interesting… I’m gonna try right now.


Not yet, @Ken… see below:


You feed both lists the same info here:


Yes, that’s right. And after this I use the list lista to feed the spinner.


Need to get back to work.
I’ll look again later if i get time.


No problem, Ken. Thanks for your time. Meanwhile I’m gonna try to discover a way here.


@Ismael_Hernandez, I was taking a look on the block Spinner1.AfterSelecting and there is a problem: If the item selected is the first item on the list, this block does not work. Only works if I choose another item.



Finally I’ve found the solution!!! Here it is:


Based on @Ken’s suggestion, I’ve found this and now I have pointed the right item in the second list.

Thanks to all of you and your suggestions!!


Nice adaptation!
Great work!