How to make the second spinner depend on the selection of the first spinner using google spreadsheet

I’m using this Google Sheet for my app to access the information, where columns A and B are in spinner 1 and 2

When selecting spinner 1, I want spinner 2 to show information only about the product chosen in spinner 1.
Example: If I choose “Camera”, spinner 2 should only show “GS0372 and GS0375”


also, how can I not repeat words in spinner 1?
In this case above, I would like only “Camera, Notebook, Tela” to appear

these are my blocks and aia


data_sheet.aia (8.9 KB)

1 Like

Hi, probably you have to study and save data in a different way to manage better the query and the search inside the table.
Anyway I think you have 2 ways .
1- make a query and save data like dictionary so you can use the dictionary’s block to make you search. Here a GUIDE to see how dictionary works about search.
2- More expensive . You have to work with variable and list and with some cicles manage the data .
Ex. Call the column A and B , save them in two variables, then manage A with a temp variable and with a for each item if item is not in list you add it to a temp list, so you will have a new list without copy to show inside spinner.
When you select the first spinner , you need a new for each item in list A where if item= select spinner you have to add the index of the item in a temp list. Now you have a list with all the index you have to take in list B , with a for each inside this temp list you have get the right items in list B (select list item list B index item (from for each )

Is more easy to code than to explain :sweat_smile:

I’ll look

see if I can help you

I already did this and it worked

I can wait :')

yeah but that’s my problem. I don’t know how to do this in blocks
I only know how to modify a logic structure, but I don’t know how to create it from scratch. I’ve been stuck on this spinner for a long time

Hi, this is one way to manage data, I hope other users know a faster way.

Procedure block is not necessary you can add the inside code where you want, I added a procedure to call easy and test it.
This block take the list from csv (if I remember right every item of list from CSV is a row) and create a dictionary with numbered keys, every keys is a row of the table and inside you can find all the titles of the columns and the values. In this way with the block list by walking you can easy get a column like a list, in the example a list of produto. If you change (text under walk all at level) produto with modelo you will get the column modelo. Refer to the guide for more examples.

Now if you have a list of produto and want to clear from duplicates, here the code.
For each items it checks if it’s in the Temp list to add or not the values, the new list is ready for spinner.

I will add the last request soon

This is my way using a dictionay, maybe some more experienced user knows a better method.
:wave: :wave:

I understood your logic, but I couldn’t. I’m sorry. I don’t know where to call the procedure
is it on the block “initialize” or “got text” from web, or other?
how to link to google spreadsheet?
Is this way right?
image

I made the blocks like yours. I disabled some of my blocks to fit your logic, but I couldn’t

1 Like

With your block you can get data from spreadsheet?

Ok , I add more information.
My list from CSV is like yout name variable , it has to receive web response with the list from CSV block , I don’t know where you use it in your project but in this code you can change them each other .
Under name variable you have to add procedure to fill your dictionary database.

This one clear spinner 1 , so you can add it at the end of the procedure, out of the variable index

According to your code you will update listview and both spinners every time you call web response.

I made these changes to the block and it worked for the first spinner. thank you very much by the way


I made these changes because the following error occurred:
image

but the second spinner is not working. the error shows me all the information in column B, but not in list format.
when I select an option in the first spinner, the following error happens:

data_sheet.aia (12.2 KB)

Because my code was written for dictionary, if you want to use your name variable you have to change something.
Show me your web got text.

here I made this to show column B in the spinner 2

but it is showing all the data, not just the data as per the spinner1 selection

Here the project
data_sheet.aia (16.3 KB)

1 Like

Thank you very much for your time and patience. ;')

1 Like

It’s a pleasure but now you have to study dictionary to continue your project :sweat_smile: The guide I linked you is very useful to begin .
Have a nice day

1 Like

yes I will. I had a lot of ideas for my project but I didn’t know how to do some. I intend to study more

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.