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

**URL:** <https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182>\
**Category:** Questions about Thunkable X\
**Tags:** lists, function, google-sheets\
**Created:** [March 7, 2024, 11:29am UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182 "2024-03-07T11:29:44Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![wulfy\_starr](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wulfy_starr/32/164356_2.png) [@wulfy\_starr](https://community.thunkable.com/u/wulfy_starr)\
**Post date:** [March 7, 2024, 11:29am UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/1 "2024-03-07T11:29:44Z")

</div>

this is the pivot table i am pulling data from:  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/f/ef49a03efd6bd8a007dfa283c3fe15a2ca9e8561.png)

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”)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/1/e171051f451f13a5906c65e8c3057860691bdede.png)  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/0/00a83381d5f42a5d5e44b8e0372ddbfbc05765aa.png)

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](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/e/deff8fbb6df209162e284fbc3b00ad6395f40e96.png)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/6/86fab20f845cd28d81c9c99a59c0f4208d240c7b.png)  
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?

---

<div class="post-metadata">

**Author:** ![tthompson41231](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tthompson41231/32/161401_2.png) [@tthompson41231](https://community.thunkable.com/u/tthompson41231)\
**Post date:** [March 7, 2024, 4:28pm UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/2 "2024-03-07T16:28:37Z")

</div>

![mood](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/4/541a29d7579e3f8d1ee686778f5f8590240dbb9a.png)  
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.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [March 7, 2024, 5:41pm UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/3 "2024-03-07T17:41:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wulfy\_starr](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wulfy_starr/32/164356_2.png) [@wulfy\_starr](https://community.thunkable.com/u/wulfy_starr)\
**Post date:** [March 8, 2024, 1:38am UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/4 "2024-03-08T01:38:44Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/8/484c261b024a02e59062bb34c44b49739c8c8c7a.png)

---

<div class="post-metadata">

**Author:** ![tthompson41231](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tthompson41231/32/161401_2.png) [@tthompson41231](https://community.thunkable.com/u/tthompson41231)\
**Post date:** [March 8, 2024, 2:11am UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/5 "2024-03-08T02:11:07Z")

</div>

What does the variable assessor equal?

---

<div class="post-metadata">

**Author:** ![wulfy\_starr](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wulfy_starr/32/164356_2.png) [@wulfy\_starr](https://community.thunkable.com/u/wulfy_starr)\
**Post date:** [March 8, 2024, 10:36am UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/6 "2024-03-08T10:36:54Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/9/79a99cfa74e253b41b758de97714a960fee35528.png)

---

<div class="post-metadata">

**Author:** ![tthompson41231](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tthompson41231/32/161401_2.png) [@tthompson41231](https://community.thunkable.com/u/tthompson41231)\
**Post date:** [March 8, 2024, 2:36pm UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/7 "2024-03-08T14:36:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wulfy\_starr](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wulfy_starr/32/164356_2.png) [@wulfy\_starr](https://community.thunkable.com/u/wulfy_starr)\
**Post date:** [March 8, 2024, 4:20pm UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/8 "2024-03-08T16:20:19Z")

</div>

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

 ![Screenshot 2024-03-08 at 11.13.41 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/7/07ac148686a73974ac935ee144b9d1cb67775639.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [March 8, 2024, 4:50pm UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/9 "2024-03-08T16:50:43Z")

</div>

> [@wulfy\_starr](#):
>
> 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](https://docs.thunkable.com/blocks/blocks/lists#find-first-last-occurrence) block.

---

<div class="post-metadata">

**Author:** ![wulfy\_starr](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wulfy_starr/32/164356_2.png) [@wulfy\_starr](https://community.thunkable.com/u/wulfy_starr)\
**Post date:** [March 9, 2024, 2:58am UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/10 "2024-03-09T02:58:41Z")

</div>

i replaced the function with list blocks, like so:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/8/a8d082b6ae8a5bd84fbcb72cda51d1e73a492b6a.png)  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/f/1f6e1d1d5f7d3bfe6857440daa9b04ba968a3772.png)

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:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/5/454e30e31219d85cc0a94ac8cf26c913767b533c.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [March 9, 2024, 7:51am UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/11 "2024-03-09T07:51:37Z")

</div>

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)](https://community.thunkable.com/t/debugging-in-thunkable-x-video/849471)

---

<div class="post-metadata">

**Author:** ![tthompson41231](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tthompson41231/32/161401_2.png) [@tthompson41231](https://community.thunkable.com/u/tthompson41231)\
**Post date:** [March 9, 2024, 1:27pm UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/12 "2024-03-09T13:27:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![wulfy\_starr](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wulfy_starr/32/164356_2.png) [@wulfy\_starr](https://community.thunkable.com/u/wulfy_starr)\
**Post date:** [March 9, 2024, 7:16pm UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/13 "2024-03-09T19:16:21Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/e/ce7f2a18039fc847b3c7eaa930b237999b190530.png)

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 :[

---

<div class="post-metadata">

**Author:** ![wulfy\_starr](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wulfy_starr/32/164356_2.png) [@wulfy\_starr](https://community.thunkable.com/u/wulfy_starr)\
**Post date:** [March 10, 2024, 12:04pm UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/14 "2024-03-10T12:04:14Z")

</div>

any ideas or solutions on what could be happening above?

---

<div class="post-metadata">

**Author:** ![tthompson41231](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tthompson41231/32/161401_2.png) [@tthompson41231](https://community.thunkable.com/u/tthompson41231)\
**Post date:** [March 10, 2024, 7:34pm UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/15 "2024-03-10T19:34:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wulfy\_starr](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/wulfy_starr/32/164356_2.png) [@wulfy\_starr](https://community.thunkable.com/u/wulfy_starr)\
**Post date:** [March 10, 2024, 10:13pm UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/16 "2024-03-10T22:13:11Z")

</div>

alright, here’s the [link](https://x.thunkable.com/copy/1bbbf0c3bf6c5e3ca73e62835be176b1) :]

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

---

<div class="post-metadata">

**Author:** ![tthompson41231](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tthompson41231/32/161401_2.png) [@tthompson41231](https://community.thunkable.com/u/tthompson41231)\
**Post date:** [March 10, 2024, 11:56pm UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/17 "2024-03-10T23:56:08Z")

</div>

Try this. For some reason it works this way.

 ![Screenshot 2024-03-10 195426](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/a/9a9e1bf465d49d1cf1b1d7a44f499c68f2e4a873.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [June 8, 2024, 11:56pm UTC](https://community.thunkable.com/t/solved-how-can-i-turn-these-functions-into-list-blocks/2880182/18 "2024-06-08T23:56:24Z")

</div>

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