# Function not returning list

**URL:** https://community.thunkable.com/t/function-not-returning-list/637527
**Category:** Questions about Thunkable X
**Created:** [June 26, 2020, 2:19am UTC](https://community.thunkable.com/t/function-not-returning-list/637527 "2020-06-26T02:19:49Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![levelupjamdownf3n1](https://avatars.discourse-cdn.com/v4/letter/l/b5ac83/32.png) [@levelupjamdownf3n1](https://community.thunkable.com/u/levelupjamdownf3n1)
#### Post date: [June 26, 2020, 2:19am UTC](https://community.thunkable.com/t/function-not-returning-list/637527/1 "2020-06-26T02:19:49Z")

</div>

Hi, I’m have the following simple code which is to grab a list from firebase and return to calling function. I’ve tried MANY permutations but not seems to work. Any ideas:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/7/6767f5d89e91b12e24165f6ab5598a97bfd30faf.png)

here’s the relevant firebase section:

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

---

<div class="post-metadata">

### Author: ![joannietw](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/joannietw/32/30139_2.png) [@joannietw](https://community.thunkable.com/u/joannietw)
#### Post date: [June 26, 2020, 4:55am UTC](https://community.thunkable.com/t/function-not-returning-list/637527/2 "2020-06-26T04:55:27Z")

</div>

Hi @levelupjamdownf3n1,

I think you should try to remove the `If (condition) not error` block since the error should return a error code (text) not the `boolean` . Then have a try again.

---

<div class="post-metadata">

### Author: ![levelupjamdownf3n1](https://avatars.discourse-cdn.com/v4/letter/l/b5ac83/32.png) [@levelupjamdownf3n1](https://community.thunkable.com/u/levelupjamdownf3n1)
#### Post date: [June 26, 2020, 11:28pm UTC](https://community.thunkable.com/t/function-not-returning-list/637527/3 "2020-06-26T23:28:34Z")

</div>

Like this? Still did not work.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/b/db9d0a8236a2ea7be2f320650233d56d921f3bc2.png)

Note I confirmed the list was read from the DB using the following code and that worked so it has to do with the function not returning the list to caller. Do do I fix this?  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/a/1a7746b6e3511d3787cb5e9eb0f56d46a94f31a8.png)

---

<div class="post-metadata">

### Author: ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)
#### Post date: [August 28, 2020, 12:54am UTC](https://community.thunkable.com/t/function-not-returning-list/637527/4 "2020-08-28T00:54:00Z")

</div>

I am having a similar issue wlith functions returning list. I’ve created an app to demonstrate the issue.

There are a variety of work arounds that could be implemented. Returning a list seems like a pretty fundamental feature to support.

Or am I missing something?

Related thread [Returning Objects/Lists from Functions - #7 by b.perkins](http://community.thunkable.com/t/returning-objects-lists-from-functions/337096/7)

[https://x.thunkable.com/copy/a3342f23c1c037dcbbce4094b5e82d38](https://x.thunkable.com/copy/a3342f23c1c037dcbbce4094b5e82d38)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/a/dabe0e6f1a8aeffd84313a98e38d43469379bd6f.png)  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/3/a3f83aa3dc66594d833adfc33fb68ede7e7319bb.png)

---

<div class="post-metadata">

### Author: ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)
#### Post date: [August 28, 2020, 7:20am UTC](https://community.thunkable.com/t/function-not-returning-list/637527/5 "2020-08-28T07:20:20Z")

</div>

I’m afraid you’ve misidentified the source of the problem. The function returns a list, but the blocks for determining the length do not work correctly.

[https://x.thunkable.com/projects/5f48a3dca2ec59809f9ef60a/project/properties/designer/](https://x.thunkable.com/projects/5f48a3dca2ec59809f9ef60a/project/properties/designer/)

 ![изображение](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/b/cb7b9feb5991f47da177d7f081d2403c3f6e104a.png)

---

<div class="post-metadata">

### Author: ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)
#### Post date: [August 28, 2020, 10:26am UTC](https://community.thunkable.com/t/function-not-returning-list/637527/6 "2020-08-28T10:26:17Z")

</div>

[actech](http://community.thunkable.com/u/actech) thanks for pointing out the ambiguity in my post. You are 100% correct that the issues is related to using the length block when returning a list from a function. Other list-related blocks appear to work correctly. Also the list length block appears to work correctly when supplied a list that is not the return value of a function (as demonstrated in the modified app long click events).

---

<div class="post-metadata">

### Author: ![gobassky](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/gobassky/32/77019_2.png) [@gobassky](https://community.thunkable.com/u/gobassky)
#### Post date: [August 29, 2020, 9:35am UTC](https://community.thunkable.com/t/function-not-returning-list/637527/7 "2020-08-29T09:35:59Z")

</div>

Your firebase structure suggest a list (aka array) of object. your directly addressing the “value” as an object won’t work. May need to use the “in list get #\_” block before accessing the object. my 5 cents worth

> [@levelupjamdownf3n1](#):
>
> Like this? Still did not work.
> 
> ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/b/db9d0a8236a2ea7be2f320650233d56d921f3bc2.png)
> 
> Note I confirmed the list was read from the DB using the following code and that worked so it has to do with the function not returning the list to caller. Do do I fix this?
> 
> ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/a/1a7746b6e3511d3787cb5e9eb0f56d46a94f31a8.png)

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 11:25am UTC](https://community.thunkable.com/t/function-not-returning-list/637527/8 "2024-11-08T11:25:27Z")

</div>


