Querying Local DB to Return List of Items that Have a Match to a Query in their Row

Sorry if the topic doesn’t make sense, I wasn’t sure the best way to describe it. I’ve tried searching the community, but this same trouble describing what I am hoping to do has led to a yield of no results.

I am sure this is pretty basic, but I’m just getting started with Thunkable X and having a hard time building this out.

I am using a Local DB with several columns. I have a populated list of all 50 states. When one of the states is clicked, I need to query the States column of the Local DB and return the item from the Name column to populate the list.

I would be extremely appreciative if someone could show me how to build this out in Thunkable X. Once I have that working, that same block will allow me to do a lot of the other things I am hoping to do!

Thank you!

1 Like

Hello there,
Welcome to our Community :smile: :tada: :tada:

So, I assume that u are using a listviewer to select States.

I think, this can help u -

Hope it helps :smile:
Thanks! :tada:

1 Like

Thank you for the quick reply!

What I’m hoping to accomplish is a little more complicated than that unfortunately.

You’re correct about the list viewer with the 50 items (50 states).

The local DB is filled with many locations. Each row has a column for the location name, a column for the address, a column for the state, etc.

What I am hoping to do is when they click on, let’s say Florida, it will query the Local DB for all of the rows where the column States equals Florida and return the result for the column Name in that row to the List Viewer.

1 Like

Hello there, :wave:

Okay. So here’s what u should do :

Solution #1

If yr listview items & local db States’ column items are ditto (the same names & letterCASE), and arranged the same, like -
(Both have same names at same indexes)

Then, this should work for u -

Else, (Both do not have same names at same indexes)

Hope it helps! :smile:

Thanks a lot! :wink:

1 Like

This looks like it’s getting very close to what I am hoping to do!

The table will look more like this:


When the list item Alabama is clicked, it would return Location 1, Location 6, and any others where State matches the clicked list item. There will be dozens of results for each of the 50 states.

Thank you very much for your assistance so far!


Hi, @martymcsupafly! :wave:

**Try this : **

Hope it helps! :wink:

1 Like

This is starting to make a lot more sense! What I’m hoping to do with this list now is to take that list that will return all Locations and fill the List Viewer with all of the results.

Here’s what I’ve got based on what you suggested, but I’m not entirely sure how to add those results to the List Viewer, whether it be adding one at a time in the loop or having the loop create another list and then setting the List Viewer text items to that list?

1 Like

Here’s the solution for the listviewer : :blush:

Hope it helps! :wink:


Hi there,

You can see a tutorial on searching and filtering a LocalDB here:



This is also very helpful :smile:

1 Like