# Find specific item in list Firebase

**URL:** <https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404>\
**Category:** Questions about Thunkable X\
**Created:** [April 27, 2021, 12:04pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404 "2021-04-27T12:04:07Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 7, 2021, 11:41am UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/41 "2021-05-07T11:41:31Z")

</div>

This is clear that you are clearing the contents of orderedList somewhere in your code. As long as orderedList contains what is already in the database key and new entries are added to it then once you save it, it will replace the existing list under the database key.

You are focusing on a single block of code that you are coping it in this post every time instead of logically following the changes to the list and see where you reset its contents.

---

<div class="post-metadata">

**Author:** ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)\
**Post date:** [May 8, 2021, 6:09am UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/42 "2021-05-08T06:09:32Z")

</div>

Yes indeed, its very clear. Believe me I am really trying to follow the logic paths (as I understands it) the best I can…  
I do only have two places in my code that handles the DB somehow, its two functions, one for “save” which is put in the “add-button-block”, and one for “sync with DB” which is put in the start-up-block.  
That’s why you always see variants of these blocks 🙂

I am, at the moment, putting every action in labels to hopefully see what is happening and where the data gets removed.

Im getting close though…

As for now I have managed to add items and keep the old ones, but the issue now is that those old items gets to numbers after saving new item when restart. 🤦‍♂️

Thanks a lot for all your help both of you! 🙏

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 8, 2021, 7:04am UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/43 "2021-05-08T07:04:28Z")

</div>

This is the third time I tell you to look for places you use orderedList not the blocks you keep copying in the post.

---

<div class="post-metadata">

**Author:** ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)\
**Post date:** [May 8, 2021, 2:00pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/44 "2021-05-08T14:00:48Z")

</div>

To Night I will sit with this again…  
I will have deep look then! Thanks!

---

<div class="post-metadata">

**Author:** ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)\
**Post date:** [May 14, 2021, 6:57pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/45 "2021-05-14T18:57:48Z")

</div>

Hi. I have rebuilt the app as I couldn’t find anywhere where my variable orderedList clear the contents of it. I have still the same problem though, but I have an idea…  
Could it be that the data/info inside my “orderedList” are JSON? Cause that’s what’s coming out from Firebase’s Get-block, right?

I know for sure that my content from Firebase are in my variable, cause I have put in on a label to show the content and it is there -, and when “generate JSON from object” I can see it.

Could it be that I need to put it as list-content, for only my Items in this variable? Could that be the reason why it wipes out all the content in DB as soon as I add new stuff?

But if so, could someone please advice me how I can get that data from DB to be a simple list/array that I can put in my variable? I have tried many different ways to get this work and red through the Thunkable docs, but I am not able to get it work.

thanks a lot for any help!

here are the get-block which I need to put in my “orderedList” variable as a list/array (?)

 ![Screenshot 2021-05-14 at 20.55.25](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/8/c85d5eebfdd8070d837433fbc6667e244de9bc75.png)

(now the variable has this “generate JSON from object”-block there just so that I am sure that it really contains what I want.)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 14, 2021, 8:59pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/46 "2021-05-14T20:59:08Z")

</div>

One way to eliminate complexity is

When you are saving your list to the DB, save it as text like this

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

And when you get it back from the database it will be a long **text** separated by commas. You can then use the `make list from text block` and convert it back to list.

This should solve your issue if you believe this is something related to the database itself.

---

<div class="post-metadata">

**Author:** ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)\
**Post date:** [May 14, 2021, 9:33pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/47 "2021-05-14T21:33:38Z")

</div>

Thanks, great idea! I will try that out!  
I am not sure if this will solve the main issue but it’s definitely worth a try 🙂  
Thanks again!

---

<div class="post-metadata">

**Author:** ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)\
**Post date:** [May 16, 2021, 9:26pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/48 "2021-05-16T21:26:04Z")

</div>

Hi.  
Thanks a lot for your tips. This worked for me and it confirmed my suspicions, that it was the JSON format that made my app crash/wiped out previous items in DB. At least that’s my understanding.  
This is the thing:

by doing your way here I got content in my variable “orderedList” that looks something like this:  
item 1, item 2, item 3. So, as I thought, when I press the save button and save new items to that list it will understand what to do.

By simply save the “orderedList” when save to DB, the value back from DB will be “object Object” if I simply ad the value to my “orderedList”. So to put it there I needed to ad the “generate JSON” block for that.Then it will look something like this:  
[“item 1”, "item 2, “item 3”]… So this will crash my app when adding new stuff in here.

I do this for practice and I want to learn. I could simply go with this method that works, but then I will have all my items as a text string in DB. So, obviously I would prefer to save my “orderedList” so that I can get my items in DB as separate Items.

Is there any other way to formate the value from DB without having to generate a JSON from it? Or, should I formate the JSON with some filtering to get rid of all those characters? Whats common for you “professionals”? How would you have done? I have tried a ton of different possible solutions for this but to generate JSON or create text from list is so far the only luck I got…  
Any tips or ideas would be much apprichated.

Thanks!

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 17, 2021, 10:31am UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/49 "2021-05-17T10:31:47Z")

</div>

That’s good news.

When you see [and] in JSON it means the content is a list. Treat it as a list in your app and add to it using the blocks in the list drawer. If you try to add to it like a text then you will overwrite the list.

You do not need to convert back and forth the values you receive from Firebase because you are receiving it already as objects and you can use the blocks in the object drawer to manage every aspect of it.

Happy Thunking!

---

<div class="post-metadata">

**Author:** ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)\
**Post date:** [May 18, 2021, 11:35am UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/50 "2021-05-18T11:35:32Z")

</div>

Hi.

It works now, I simply set the variable “orderedList” to be the value from DB when start up the app. (I have tried this before many times but then the app has crashed for some reason, maybe there was something else there disturbing. But now it works and it will not wipe out anything after restart.

But this is depending on that the content in DB is my items only, but when I add a new item in a list I get this “scopeVariableInfo”-stuff in there as well and when that comes into my DB the result from the getBlock in my code will be “object Object” and then this whole process won’t work.  
If I manually remove this “scopeVariableInfo” in my DB and restart my app it will work again.

 ![Screenshot 2021-05-18 at 13.26.01](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/1/417511c4bab5d74cacfa538e6764de43fd3545a9.png)

I remember you said that you had some workaround for this “scopeVariableInfo…”??

Thanks  
/A

---

<div class="post-metadata">

**Author:** ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)\
**Post date:** [May 20, 2021, 2:27pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/51 "2021-05-20T14:27:13Z")

</div>

Hi muneer. May I ask, did you had some workaround for that scopeVariableInfo”-stuff?  
I remember you said that you had a wile ago…??

Thanks!

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 20, 2021, 2:43pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/52 "2021-05-20T14:43:48Z")

</div>

One easy solution is set it to **null** and it will disappear.

---

<div class="post-metadata">

**Author:** ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)\
**Post date:** [May 20, 2021, 3:16pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/53 "2021-05-20T15:16:24Z")

</div>

Set what to null?  
scopeVariableInfo? Can I access that inside Thunkable?

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 20, 2021, 3:18pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/54 "2021-05-20T15:18:25Z")

</div>

User\_ID/items/\_scopeVariableInfo

Set it to null and it will disappear.

---

<div class="post-metadata">

**Author:** ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)\
**Post date:** [May 20, 2021, 3:22pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/55 "2021-05-20T15:22:08Z")

</div>

Ok great, awesome! Thanks! I will try tonight!

---

<div class="post-metadata">

**Author:** ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)\
**Post date:** [May 20, 2021, 6:51pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/56 "2021-05-20T18:51:52Z")

</div>

I just wanted to say thanks! This worked well for me!  
This is how I did:

 ![Screenshot 2021-05-20 at 20.49.49](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/9/2923ab4e0843ee0fab3b73cb5ee229303b9881f1.png)

Maybe the would be some even more smooth way doing it but this works 👍🏼

Thanks Muneer

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 21, 2021, 11:09am UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/57 "2021-05-21T11:09:39Z")

</div>

Welcome. Glad to see it working for you.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [May 21, 2021, 1:05pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/58 "2021-05-21T13:05:08Z")

</div>

This is my solution to the problem. In a clean manner

I made this simple data  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/9/89bfc55fba58d298486a86cf31431b163bb32105.png)  
This is the screen. When I press Get List I get the list in the screen  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/a/4a2e6d37737c6503b6485bf20977c7d7c27b0e97.png)

This is the code that runs

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

I can add to the list using this code

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

And I can save the list back to the database using this code

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

It will always be clear and without the annoying \_\_scopevariableInfo

---

<div class="post-metadata">

**Author:** ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)\
**Post date:** [May 21, 2021, 3:35pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/59 "2021-05-21T15:35:53Z")

</div>

Thanks for this!! This looks so much cleaner then my project! I will try it out t night! Great learning! Thanks for this! 🙏

---

<div class="post-metadata">

**Author:** ![andreas.sjdtomypv](https://avatars.discourse-cdn.com/v4/letter/a/e5b9ba/32.png) [@andreas.sjdtomypv](https://community.thunkable.com/u/andreas.sjdtomypv)\
**Post date:** [May 22, 2021, 2:20pm UTC](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404/60 "2021-05-22T14:20:42Z")

</div>

I’ve actually changed to your solution as I think it’s much cleaner.

My I ask:  
If I simply put the value on my variable when “get” I will get the same result in my label (for check) as if I put the “make list from-value”. But if I save my app will crash.  
What is it making the app crash then even the output from “get” block for db is the same?

Is it that even if it looks the same my output will be a text because I have saved as a text?  
Just want to understand.

This will work great:

 ![image0.png](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/3/f3d847704962b533444051895650b264f58c3797.png)  
 ![image1.jpg](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/0/10f62a891bbdb5c6d21a5dca2242eb8e88272f9d.jpeg)

This will look the same in the label but crash the app:

 ![image2.png](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/9/e9776b0b302cd057f5f08a100b2ab61e7f4013e2.png)

 ![image3.jpg](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/7/e798961a78111dd6949c53cd0145df1fe5a35313.jpeg)

 ![image4.png](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/8/7840720b2814888c5f56109fd077d0329732e6dd.png)

Thanks

/Andreas

[Previous page](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404.md?page=2)

[Next page](https://community.thunkable.com/t/find-specific-item-in-list-firebase/1248404.md?page=4)
