Can anybody explain how to search items in a list (from airtable)?

app entireList has to have data. The updateTempList function loops through its items to look for something that matches whatever you’ve typed in your text input field.

Try adding this and then testing by searching for any of the fruits in that list (e.g. “apple”):

Screen Shot 2020-02-10 at 2.11.07 PM

After you successfully test it, you’ll need to populate app entireList or replace that block everywhere with your actual list that should be searched.

Thanks for this! I added upon this and now I have it almost working.

Here are my blocks:

Annotation 2020-02-10 222340

So this has called the text items from my populated item-list, however the problem now is that when I get rid of the text in the search box and enter new text, nothing appears. I imagine this is because it’s looking into the list that’s being displayed. So if it’s only showing three results, it’s going to search those three results for the newly entered keyword. Now I need to figure out how to make it totally repeat the process when a new search is entered…

app entireList needs to be just that: the entire database. It should include ALL of the items you ever want to search (i.e. all possible items).

Edit: in the screenshot right above, you’re populating it with from Item-List get text items. That’s not going to work for a loop, really. You need to assign a variable the value from Item-List get text items and then use that for the search loop.

You need this block:

Screen Shot 2020-02-10 at 3.34.29 PM

1 Like

Thanks @tatiang, I am trying to run some tests with this and it seemed to be working but now the app crashes every time I open try to open the list - as in when I click through a restaurant as seen in the above GIF from earlier on. I will keep at it and see if I can sort it out!

Made the mistake of updating my app to solve the problem, now the thunkable app won’t even open…

Hi, @chris.bailey230698t! :wave:

You have just a small thing to do with my example, which is -

  • You have not set the variable x to anything - that’s why nothing appears.
  • So, when you get the column, set the variable x list to column.
  • Before setting the list, make sure you clear the entire list x, before getting the column.

By this, my example should perfectly work for you. :+1:

Thanks! :blush:

1 Like

Thank you :slight_smile: @kartik14 How do I set the x to the column when it was created in a function? Do I need to initialise it? I’m not sure where the column will fit in?

1 Like

If you are using a variable created in the function, you could put the function initialization block in the then do section of your airtable get column/ block. Then put the column value (green block)from airtable into the variable input of the function and initialization block

1 Like

So the search function is now working using the @tatiang method however I will give the @kartik14 one another try to see how they compare using your advice @jared in regards to the column block! Unfortunately I’m having some real issues with the most recent update to the Thunkable app which is making everything take much longer as it keeps crashing :confused:

Okay so I have this working the same way as the @tatiang method but I need the list to reset when the search box is emptied… I’m assuming I need it to break out of the process and return the list to it’s original state before the search submission was made but I’m not sure how this is done? I’m sure I’ve seen this mentioned elsewhere so I’ll scour through the other posts and see if I can find it!

I’m now trying to set it so that the search button turns into a cross (delete) button that will reset the list - which should work in the meantime and seems to be getting somewhere! Unfortunately the problems with the Thunkable app are making it too difficult to work with so I will be leaving this for the morning!

Hi, @chris.bailey230698t! :wave:

I have made a rough structure of how your blocks would look -


You can get the variables x & y by right-clicking the purple function -

image

Thanks! :blush:

1 Like

Thank you for this!! :smiley: Do you know how I could make it so that the list refreshes itself when the search box is empty?

1 Like

Hi, @chris.bailey230698t! :wave:
I am glad my solution worked for you :blush:

If you are using my solution for how to search, you can modify your blocks like this -

Thanks! :blush: