(Solved) How can i turn these functions into list blocks?

this is the pivot table i am pulling data from:
image

what i have here are these functions that search for the class code and return the “Student Mood Count” from the “Student Mood 2” column:
(for example, if i go into the class with the code “er64Hz”, it should return 5; “fg45Wg” should return 1, and “Rw77Tx” should return 2. these numbers would be pulled from the “Very Good” cells from the “Student Mood 2 column”)


i am currently trying to turn them into list blocks so the process of loading this data can go by quicker, and this is what i came up with so far:
image


when i go into the “er64Hz” class, the label returns 5 just fine. however, when i go into the two other classes, they return “undefined”. what would be the better way to go about this?


Obviously this is just an example and you don’t want to get the list of values every time (unless you have to). I just put it together so you can see it all.

I would encourage you to consider using the Airtable API for this since its filterByFormula API request is flexible and powerful for doing all kinds of searches and sorts.

1 Like

this is what i came up with using inspiration from your code, but it never seems to actually loop. i’m trying to see if i can pull the second item from the list (Bad), but the label always returns 3, meaning it never loops

What does the variable assessor equal?

the accessor is basically the class code. it gets set to the class code of the class you’re clicking on

It seems like it’s correct. I have a copy of your sheet and this method worked for me. Maybe that row ID function is incorrect.

this is the row ID function in case you want to see what’s wrong with it:

You can replace that whole function with the Find first occurrence of block.

1 Like

i replaced the function with list blocks, like so:


and i’m trying to pull data from a different pivot table, but i’m still running into the same issue of the loop not incrementing:

How do you know the loop is not incrementing? I don’t see any wait blocks in your loop so you’re only going to see the last successful/true value for the if condition.

You’ll need to do some debugging to figure out which variable(s) including i have the values you expect them to and which do not.

I use this method: Debugging in Thunkable X (Video)

Try @tatiang idea and if you still need some assistance and you’re willing to share your project, I can help you out.

going back to the same pivot table i used before, i used the debugging method trying all 5 items from the list. issues only arise when i try to pull data from specifically the second item in the list. for the first class i click in, the label is supposed to return 5, because the student mood count has 5 “Bads” in the aforementioned pivot table. however, it still returns 3, since the label is still seeming like it’s only returning items from the first item in the list, and never the second. all of the other items in the list work fine, however:

also @tthompson41231, i wish i could send you the link to my project, but it has firebase integration and you would need to make an account with a specific email address :[

any ideas or solutions on what could be happening above?

Like I said, everything looks correct there, but I would need a wider view of your block. And if you do want to share your project, just make sure you uncheck share API keys. I don’t need to log into your app I just need to look through the blocks. If there’s any sensitive data in there, you can make a copy of your project and just delete all unnecessary pages that you don’t want me to see.

alright, here’s the link :]

the code i’m talking about is in “Class Page”

Try this. For some reason it works this way.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.