How do you find corresponding data in sheets via listview?

Hi! I am using listview to organize all players in selected team. The Google sheet connected has two columns: the player and the team the player is in. If a certain team is selected, how can I set the listview to only the players apart of the specific team?

This is what the sheet looks like:


for example, if The bumblebee team was selected, only Jemma and James would be on the listview.

Get col B and C then use new filter list block

Them use this new method of filtering which reduces complex blocks to simpler

Since you get only col B and Col C index 2 of each item only we required. Add the above block at set listview elements to

Here the text box text is team Name.

You can set it in your style, but if you get col B and C (stored in the global list) then set team name in the place of tex box text you will get only the player name for the selected team.

2 Likes

I have done that I changed the code but this error appears:

RuntimeError. Irritants: (The operation select list item cannot accept the arguments: , [["Coach Barb's Bumblebees team", "Jemma"]], [2] Bad arguments to select list item)

This is the code:





Your range reference is B2:C45, so I would expect at most a two column table with 44 rows as a result.

But you are asking to get the third item of the rows (two items each) that match the team name.

I don't know why the error message mentions item 2.

This can't be diagnosed without seeing what is in global allPlayers.

This is the sheet I use to store the data. HBplayerRoster - Google Sheets

I put the range as so because I want the app to read the two relevant columns (B and C) but I can change the code so it reads the whole sheet if that makes more sense.

Use Do It.

on which block? I tried but it still shows the error

Try to debug the obtained data from get global all playera

Connect in companion, once error is obtained drag one get variable from the drawer, change into allplayers, click right click on moise, select the Do it and share use the result

Since you are using iOS and I only have Android, I don't know if there is a Companion for iOS.

So here's a way to see what arrived in GotRangeData.
Add a Label for debugging and show what is in the label.

Hi
How can I debug? I tried the variable set to allplayers but it didnt work

I changed the block readRange to read sheet and it shows this error now:

I already tried clicking do it to multiple buttons and the error keeps popping up.

This is the .aia

HomeBase_copy (4).aia (307.0 KB)

the screen is "roster"

I could not deal with the start value, so I added a List Picker to let the user choose which team's roster to view. I think it's better that way, anyway.
image



HomeBase_copy5.aia (308.3 KB)

I had to add a section to the incoming sheet data loading to also load the List Picker with the unique team names from the team name column. (I probably should have removed item 1 (the headings) from the sheet data before processing it.)

The List Picker sets the global team name to its selection, and asks for the sheet download again, leaving the team name filtering to that event.

Is it possible if I just connect the listpicker to the sheets with the team to be easier? Or would I have to add more code

Isn't that what I did?

It does not work when I test it on my IOS, the listpicker does not show any elements.
This is probably because the whenScreenInitilize block doesn't have a setListPickerElementsTo: and the sheet with the team names is not connected. How can I fix this?

If it works on Android, and not on iOS, you must be using some feature that is not yet working on iOS.

Check the FAQ.

Thanks for your help