Dynamic Dataviewer Search

Table of Contents

Setup

Explaination

Project Link

Setup - Filter View

Follow the setup in the image below.

Setup - Data Viewer
Add a data viewer and make sure to select ‘Filter View 1’

Setup - Blocks

First create a variable to hold the following list (‘zz’ is intentional):
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,zz

Screenshot 2025-09-25 at 11.50.59 AM

Then add the following blocks

Explanation

First, when we aren’t searching for anything, we want to let them see everything in the data table. The filter rule below, where we get from a to zzz, grabs everything in the table.

Next is the complicated part. This is when we start searching. It works much like a dictionary, so if you know how to search for a word in a dictionary, the logic is very much the same.

Let’s say we type ‘m’. If we pretend our data source is a dictionary, we look for the page that starts with ‘m’ and we get all pages from that page to the end of the book. But this is not what we want. We want just the words that start with ‘m’, so we have to stop when we see ‘n’.

Let’s now say we typed ‘mi’. We want all the pages that start with ‘mi’ but end at ‘mj’.

So in Thunkable, we have two rules. One that tells the start, which is what the user typed, and one that gives the stopping point. In the second rule of the photo below, we are getting the last letter of what the user typed, and incrementing that letter by 1. So if the user types ‘man’, the rules will look for words that start with and come after ‘man’, but stop at any words that start with “mao”.

2 Likes

Hey @brianl
Thank you for sharing this. I really like the idea!

While testing it, I ran into an issue with Two-word items, not showing.
For example, when I typed part or all of the second word (like “soda”), the search returned nothing.

To fix this, I added a loop that goes through the whole list, checking if any item has more than one word. If so, and the second word contains the search term, I set that item name into a variable and use it in the filter.

Then a new issue came out, which happens when there are multiple list items with the same first word.

For example, if my list contained both “orange” and “orange juice” and I searched for “orange,” only “orange juice” was returned.

I solved this by adding another condition that verifies that it is the second word of the item name that contains the word.

Here’s the project I tested this on: https://x.thunkable.com/projects/68d5b119d2e35ec3b721aed4/

My only remaining issue is with duplicate second words. For example, if the list contains two or more items named “juice” (or “soda”), only one of them is returned.

Do you have any ideas on how to handle this so all of them appear in the results?