Hi, i’m having problems with these blocks.
They are supposed to search on AirTable and get a result.
Everything works fine, but instead of giving me two results, it just gives me one doubled.
For now the variable “cocktail_scelto” has been set to “Alessio Simonelli”.
Instead of giving me his two different cocktails, it gives me two items but same results (image and name of the cocktail).
Anyone can help?
This is the AirTable
Hi, i’m having problems with these blocks.
You’re trying to do to much in one loop cycle. Asynchronous functions (Google asynchronous thunkable for more info about this) need time to complete.
For starters, try embedding the second Airtable Get Cell block inside the “then do” section of the first Airtable Get Cell block.
By doing as you said it takes the picture from “Greeky Tiki” for no reason at all. The variable is still the same as before.
Can you show a screenshot of the entire set of blocks?
Are you trying to search for a text input value from the user and then display the values from two columns in an Airtable row that matches the text input?
Yes, it is exactly as you said.
That’s the missing part that i didnt send cause it appears to work.
I need to get the value from “Immagine” and “Nome Cocktail” by the “Nome Creatore”(which is the variable SchedaBarman" in this case is set as “Alessio Simonelli”)
My idea would be to do a Get Column, then find the first occurrence of the search term in the column list (where “column” is the green column block) and assign that value as the row index #. Then, use the Get Cell block twice… once to get each of the values you want to display, using the row index #. That way you’re not really using a loop at all.
If you need a demo, I can make one later.
Also, you probably want to put that “delete all rows” block inside of an If [error] else --> delete all rows. But that’s up to you. The way you have it now, if the Airtable Get block fails, you’re still deleting the rows in your data source.
My blocks work well if there’s just one value in that list (as well as it works on yours), the main problem is that if the value is rapresented twice in that list, i’d like to get both values:
if Alessio Simoneli is shown twice in the list, each time with different side-values, i want the Data Lister to show both of them.
I want the Data List to show:
Nome Cocktail - Immagine (from the first row where Alessio is shown)
Nome Cocktail - Immagine (from the second row where he is shown)
Right now, with those blocks it defines 2 items, which is good, but gives both of them just the same Nome Cocktail and Immagine, ignoring the other value.
If you go up, if I search Alessio Simonelli, it gives me 2 items in list, both showing Rosa Del Deserto’s “Immagine”, and Rosa Del Deserto’s “Nome Cocktail”. It ignores the other one “Shima Ale” which also belong to the same.
Hope i made it clear.
Still have troubles with this.
Finding muliple occurences of a item often involves a loop. That will mean a signficant restructuring of your search. Probably the biggest problem is that asynchronous blocks like AirTable GetCell, do not work well in loops. The problem can be fixed, but it takes a little bit of work (Wrapping Asynchronous (then do) blocks into a Synchronous Function resolves unpredictable results).
After addressing the asynchronous issue, the search is pretty straightforward.
- Make the first block in the Click event an initilization of a list variable (e.g. FoundItems)
- Instead of using the block FIND FIRST OCCURENCE OF ITEM use a FOR EACH loop.
- In the loop, if the item matches the APP SearchTerm add it to the FoundItems list
- After the loop has finished, use the MAKE TEXT FROM LIST block to display the results
I tried your way yesterday, it won’t work either.
I’m starting to believe that the problem is here:
When I call the FIRST occurance in the list, it will always get the first one and it’ll ignore the rest.
I’m trying to figure out how can i make blocks to get the second item in list, the third…as many as the “amazon” list (random name) contains.
Right now i’m trying this with bad luck:
I’m missing a block that does’t always take the first or last item in a list, but it takes the # (Variable called Number) in it.
I’m aware of the block “get #1 of list”, but it doesn’t provide me an occurance if the text is in the list. In this way i could each time pick The first occurance of the word in the list, the second one…and so on.
Hope i made it clear.
Thank you very much for your help.
You cannot perform a loop with the GetCell block. It will cause errors. You need to wrap it in a function first:
Call the function instead of the AirTable GetCell block and the loop should work
Well, i guess it goes too much beyond my knowledge. I tried but for sure i’m doing something stupid, it’s just too far away from where I am know.
Hope I got close though. (on the side screen i copied the blocks one by one)
Sorry for the slow response.
Here is a solution to try:
The data I used:
Rather than use the GetCell block, I used the GetAllRows block. I think this will run much faster, since it only needs to make one call to AirTable instead of calling Airtable to check every row. The Repeat Until block makes sure Thunkable waits until the results from AirTable have been processed (otherwise errors and unpredictable results will occur).
The result of GetAllRows is a JSON list. To get your results you will then need to process the JSON list. I’ve included a few examples in the button1 Click event.
I hope this helps.
Thank you for your massive help. I really, really appreciated your effort.
I wish I could say that the problem is solved, but still i’m building blocks that I have no idea what they are about.
I will implement this feature on the app when i’ll understand at least the 90% of it, for now i tried hard with your blocks, but i messed up, surely because of my lack of knowledge and not because of uncorrect blocks.
I marked yours as solution as i’m sure loads of people will find it outstanding.
Try opening the app link and enter your Airtable data (keys, Table, etc.). It SHOULD run against your airtable. Then you can start changing blocks to see what each one does.
Best of Luck. Feel free to send me a direct messages with specific questions.
This works perfect! ive spend so many hours due to asynchronous issues in airtable… Thanks!!!