Need help with Filter Bar and Google Sheets as database!

[mod edit - after quite a few posts it became apparent that this was being tested on iOS companion]

I'm quite new to App Inventor and would like to create a search bar that would allow a user to search for, say a keyword, and would like them to be able to view the definition. The keyword and definitions are stored in an external database on Google Sheets and I would like the program to retrieve the data from there.

The problem is essentially this: When you search the list using the filter bar and click the first option, the definition that is displayed is from the first index on Google Sheets.
I don't know how to change this code and need help!!!

I've added some images of my code and would like to know how I can change the "ListView1. After Picking" so that it shows the definition that I want. I've also added a video of how the code works when executed so that you can identify the problem.




Why do you need two screens for this? Just use the visibility feature of vertical arrangements and run all this one Screen1, then you don't have to worry about data transfers between screens, not switching screens correctly etc, etc, etc....

1 Like

If you filter a listview, it returns a shorter list (based upon the filter) with a new index. You will need to do a comparison of the selection with the contents of the original list you fetched from google sheets.

How do I do a comparison of the selection with the contents? Could you please explain this. Thanks

On testing, it looks like MIT have fixed this issue, because it is returning the same index. I must have been asleep when this happened! :upside_down_face: You therefore should not have to worry about different indexes when filtering a listview.

Your problem is that you set the list elements before you have read the data. move the set list elements block to the end of the read data procedure.

I tried moving the set list elements block to the end of the read data procedure but it didn't work. Have I done this right?

Looks OK, this works for me

1 Like

For me when I select an item from a list after using a filter bar, (like "expand"), it shows me the definition for "factorise" and I don't know why. Do you think it has to do something with the way I have my Google Sheet database structured?

Try like this:

image

1 Like

Okay, thanks. I'll try that out now.

So I tried that code (attached an image below) but it still displays the other definition when used with the filter bar.

So if I like searched up "variable" on the filter bar and clicked on it if it appeared first, it still shows the definition for factorise for some reason.

show your responseContent

Is it the google sheet file?

1 Like

Do you have any other listviews in your project ?

No other list views, Is this the responseContent?

Yes, thank you. That looks OK.

Try my aia, does this work as expected for you?

filterlistview.aia (3.1 KB)

1 Like

I tried your aia, it's still showing the same problem. I've attached a screen recording of it below:

Android or iOS?