[Solved] How can I improve this manual search functionality in my app?

Hi everyone! I am getting 3800+ google sheets records converted into JSON, from the custom apps script I built into my google sheet. I display the JSON data I get into a normal listviewer by parsing the JSON into list items. The data displays perfectly, which is good. I also have a search functionality built for my list viewer, whose blocks are as follows -

image

The variable raw list contains the 3800+ rows I am showing into my listviewer, parsed from the JSON response. As you can see, currently I have a for loop which iterates through the list to find rows with matching keywords, entered into the search textbox.

When I tried to test the search module on my device the app freezes for some time and quits. This might be due to the for loop having too much data to go through - so I need to make this search process efficient, so my app doesn’t slow down every time the search function is executed. Does anyone have any ideas on performing an efficient search on large data like I have? Any guidance is appreciated! Thanks :slight_smile:

Is it possible for you to do the search within the Google Sheet instead? Because it would probably be faster to update a cell with the search term and then get back a set of value from a different cell that has the search formula.

1 Like

i made this demo - is this the kind of search you are doing?
the link is a live project link
https://x.thunkable.com/projects/62e8d867d0918b0bd0014f65/369828ae-e3a8-4e73-9214-46128865d0e8/designer

it’s reading a 2500+ row spreadsheet , each row consisting of seven words, at least one of those words is the spelling of the numbers 1-13, which will be the keys you search for.
here’s the link to the spreadsheet:

note: it doesnt read the excel as a datasource . it’s reading it using the technique described here:
read more about it here:

4 Likes

Hey @kartik14

You may want to consider finding a way to query against your db such as the method provided by @manyone or using a db like xano/supabase/airtable that you can truly query against.

You can do searches with the google sheet method but it’s not efficient or scalable when compared to the true ability to search/restrain results from your database via an api call.

My latest app utilizes firebases firestore and several cloud functions to “do the dirty work” of all my CRUD actions. Makes searches easy as pie and I know you know some code. If you wanna hop on a public call sometime I can show you/a small group how to set up your first function in the Firebase cloud and execute a query against firestore data!

I’d only do this if there was interest from a small crowd of folks.

Should only take an hour or so

4 Likes

Thanks everyone for replying! (sorry for the delayed reply, I was caught up with exams)


@manyone your method works the best for me - I didn’t know about this querying method on google sheets - I’m going to use it every time now! When I replaced your spreadsheet’s ID in blocks with mine, it didn’t work and threw a Oauth error - I then made my spreadsheet shared (anyone with the link can view option), and it started working :smile:

@Jared_Gibb I haven’t tried Xano and supabase yet, but I’ll give them a try too :slight_smile: thanks for the recommendation!

2 Likes