Populate a list from airtable and then populate buttons error

Hi Thunkers

I am at a loss of why this code is not working. I have tried so many different options and still can’t seem to solve it.
Its a simple quiz but I would like to randomise the answers, the data source is working fine the answers can be set to a button directly but when I use a list nothing works so I am doing something wrong on the list. I have used similar before but oddly whatever try I can get the list to show in anyway even in a list viewer.

grateful for any help

1 Like

Did you initialize your answer_list variable as an empty list?

2 Likes

I did indeed. the base is connected as I can get the other fields to populate the labels and i created a button to get direct from the base the data in the fields selected and that works yet it still will not populate the list> i tested by adding a list viewer and that does not show so I am sure its to do with the list> i also tried creating a 2nd list and shuffling the first list into the second but no joy. I have tried so many different options

1 Like

If you want, you can post the link to the project here or send it to me in a private message. It’s hard to tell what the problem might be just from the blocks you shared.

1 Like

Brilliant sent you a message with an outline of the project and a link I am happy to post a fix

2 Likes

One problem you might be having is that you’re getting and removing list items this way:

Depending on what your list looks like, that might not work properly. For example, if I had a list that looked like this:

A, B, C, D

And I ran those blocks, they would:

Set Button_option1’s Text to A (the first item of the list)
Remove A
Set Button_option2’s Text to C (now the second item of the list)
Remove C

…that’s it. At that point, the list would look like this:

B, D

And any attempts to get the 3rd or 4th item from the list would fail.

What you probably want to do instead is get and remove item #4 first, then #3, then #2 and finally #1. That way you’re not affecting the other items of the list that you still need to get.

1 Like

I’m also a little confused. You said you’re using AirTable but what I’m seeing is a local data source with most of the cells having the value “Thunkable.”

One way I start to debug things and narrow down where the issue is located is to add Label values like this, sometimes with a Wait block after each one:

When I run that function, my DEBUG label value gets set to “B”. So I know that the blocks right after “B” and right before “C” aren’t working as expected.

1 Like

I simplified your project greatly and when I deleted every other screen, the list started working properly. I’m still not sure what the problem was but I’ll send you the link to the simplified project.

I was looking for a duplicate variable initialize block but I didn’t see one.

Here are the blocks from the linked project:

1 Like

Great. When you share a project it does remove the airtable and gives you thunkable I think thats new in drag and drop. For the I did try the remove first from list and also tried remove random and that did not work. Thanks for your help I will take a look and amend from there

2 Likes

Sorry, I wasn’t aware of that. Anyway, I hope my comments are helpful.

1 Like

It is really odd as I have used the same code blocks and its still not working and I had done these options yesterday. I also have created debugging labels and also buttons. The buttons will get the data directly as will the labels so it’s still a list issue. I have used a list viewer and nothing shows but it shows in the labels and buttons that do not use the list. It is odd. Jane has also been looking. I have a similar app that works fine. I will just keep going!

1 Like

Just a note

When you send a project link to someone, Thunkable will change the Airtable and Google sheet to local tables. This is for both the Legacy and the DnD.

I actually like this feature as it protects users from giving away their connection codes and I normally use it when I want to creat a local table similar to the connected table (Airtable or Google sheets) I just make a copy and use the project copy with all local tables instead of recreating the table myself and carefully creating every field noting the case of every letter in field names.

Another Note

I found the the row number sometimes work as a sequence from 1 and so on and sometimes it doesn’t. It is worth checking that.

I many times full into this trap when trying to retrieve values.

1 Like

Thanks Mumeer

The row number works fine and it also brings back data from the base with no problem and filters it not problem It appears to be related to the list. The data set is large so I am filtering and then refer directly to the row to bring back the relevant data. The data is tested in buttons directly but I need to shuffle the answers so I am using the list blocks to allow this but its this that wont work.

1 Like

Before assigning the contents of the list to the 4 buttons, show the list in DEBUG_label's text, see that the list contains the expected values first.