# Saving two properties of an object to an array in an variable

**URL:** <https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198>\
**Category:** Questions about Thunkable X\
**Tags:** beginner\
**Created:** [August 9, 2021, 8:49am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198 "2021-08-09T08:49:27Z")\
**Posts on this page:** 20\
**Page:** 1

<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:** [August 9, 2021, 8:49am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/1 "2021-08-09T08:49:27Z")

</div>

Hi  
I have an input-view in my app where I put info in two fields. One plain text and one a date through the date-picker.  
It works fine, but now I would like to put these in a variable to be able to use the data in other processes in the app. But I can’t figure out how to do this.

This is what I am trying at the moment, but it gives me Null.

 ![Screenshot 2021-08-09 at 10.42.24](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/f/ff5456ae4d23df857a490e01e0c93e0cd127f232.png)

Any tips would be very appreciated! Thanks!  
/ A

---

<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:** [August 9, 2021, 8:55am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/2 "2021-08-09T08:55:56Z")

</div>

The `app variablle myList` is a list. To get information from it into a label you need to use something like this

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

---

<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:** [August 9, 2021, 8:59am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/3 "2021-08-09T08:59:19Z")

</div>

ah…ok thanks! I will try 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:** [August 9, 2021, 9:03am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/4 "2021-08-09T09:03:00Z")

</div>

hm…  
It still give me Null though?  
Am I doing something wrong in using the “Join”-block for the properties? I just count come up with any other idea for how to point to these fields “Text” and “Date”…

 ![Screenshot 2021-08-09 at 11.00.40](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/0/a060ef0764aa81da48652337d5d0cf0973e3aad8.png)

---

<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:** [August 9, 2021, 9:05am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/5 "2021-08-09T09:05:28Z")

</div>

I just saw that I had put a list in a list (again), I changed that but it still gives me Null…

 ![Screenshot 2021-08-09 at 11.05.40](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/c/8c4e210365938148f8dbc5d9c23124e35794a85f.png)

---

<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:** [August 9, 2021, 9:11am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/6 "2021-08-09T09:11:14Z")

</div>

Don’t use the `join text` use only one of the properties.

---

<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:** [August 9, 2021, 9:13am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/7 "2021-08-09T09:13:11Z")

</div>

ok, yes it works if I remove the Join-block.  
But how can I get two or more properties in there? ( maybe a stupid question ?)

---

<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:** [August 9, 2021, 9:15am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/8 "2021-08-09T09:15:23Z")

</div>

See this example

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/0/80a4fdf9c6d0bae7eb27823a83703278fc4c4c14.png)

---

<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:** [August 9, 2021, 9:20am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/9 "2021-08-09T09:20:39Z")

</div>

Thanks a lot! It works great! 🙏

May I ask…If I want to get ALL items from that list, not only #1. Is there any trick for that?  
I tried ![Screenshot 2021-08-09 at 11.20.11](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/c/8c5c92835b9f5ba1bef5bb4d310a60e7851bd7de.png)  
but that gave me Null again…

---

<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:** [August 9, 2021, 9:23am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/10 "2021-08-09T09:23:26Z")

</div>

There are **TWO** blocks with the name `length of`. One in the `Text` drawer and one in the `List` drawer. You should use the one in the `List` drawer and you should get 1.

---

<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:** [August 9, 2021, 9:32am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/11 "2021-08-09T09:32:43Z")

</div>

Ah sorry, I had missed that, I only thought there was such block in the Text drawer.

This is what I have done so far, and I get both of the fields to show in the label, but still just one at the time.

 ![Screenshot 2021-08-09 at 11.29.49](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/c/3c9b96ccc76cb9dd6d9b1ac1dacfece523af3a2d.png)

What did you mean by this: ![Screenshot 2021-08-09 at 11.31.07](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/e/2e925334c1f57be12ec2353938a924a613e448ce.png)  
Maybe I misunderstood something here…

---

<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:** [August 9, 2021, 9:42am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/12 "2021-08-09T09:42:13Z")

</div>

> [@andreas.sjdtomypv](#):
>
> What did you mean by this: ![Screenshot 2021-08-09 at 11.31.07](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/e/2e925334c1f57be12ec2353938a924a613e448ce.png)  
> Maybe I misunderstood something here…

I mean currently you have **ONE** object in the list. The `length of` will give you the number of elements in the list. If the elements are actually objects with number of properties then the `length of` will not see the properties inside the objects. It will only see the top object.

---

<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:** [August 9, 2021, 9:44am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/13 "2021-08-09T09:44:39Z")

</div>

> [@andreas.sjdtomypv](#):
>
> This is what I have done so far, and I get both of the fields to show in the label, but still just one at the time.
> 
> ![Screenshot 2021-08-09 at 11.29.49](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/c/3c9b96ccc76cb9dd6d9b1ac1dacfece523af3a2d.png)

If you want to get the last element (entry) in the list, you can simply use.

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

---

<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:** [August 9, 2021, 9:51am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/14 "2021-08-09T09:51:37Z")

</div>

ok but I do only have ONE object. This object has TWO Properties.  
And I can see these two properties in my test-label now. Put only for one (the last) entry.  
I would like the label to show all my entries (included the last one).

The main idea here is that I want to control that this variable is containing what I expect. (my array including the last entry which comes with this klick). I simply want to see what’s inside my variable 🙂

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:** [August 9, 2021, 9:54am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/15 "2021-08-09T09:54:11Z")

</div>

> [@andreas.sjdtomypv](#):
>
> And I can see these two properties in my test-label now. Put only for one (the last) entry.  
> I would like the label to show all my entries (included the last one).

Can you explain more?  
I did not understand what you mean.

---

<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:** [August 9, 2021, 10:03am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/16 "2021-08-09T10:03:21Z")

</div>

ok.

So, I got this view.

 ![Screenshot 2021-08-09 at 11.55.40](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/8/08400d8a0c94aeda5eddef3b32f07523ea0841df.png)  
I can entry some text and a date.  
I want to save this data in a variable so that I can use this information later in the app.  
To see that I indeed are saving this data in this variable I have put a label at the bottom to show what’s inside that variable. (at least that’s what I am trying to do.

So, when I click that save-button, this code will run.

 ![Screenshot 2021-08-09 at 11.59.15](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/9/e9b0def98627faf6e64fff785f77c53e2d26dca6.png)

And the issue here is that I do only see this last entry in my label, that makes me think that my variable only contains this data (even though maybe that’s not the case)

Hope that makes it more clear?

---

<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:** [August 9, 2021, 10:19am UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/17 "2021-08-09T10:19:24Z")

</div>

Why do you need to save the object to a list?  
Why not create its own variable if this is not actually part of a list?  
You can even save it to Firebase separately.

---

<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:** [August 9, 2021, 12:03pm UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/18 "2021-08-09T12:03:28Z")

</div>

I wanted to somehow specify these fields “Text” and “Date” so I can use them later in ex a DVL.  
I couldn’t come up with any other idea to do that then to make an object with these fields in it.

I guess it doesn’t necessary have to be a list, I just thought that at some point it needs to convert to a list if I want to show it in the DVL later…?

This is how one entry will be shown in one cell in DVL:  
 ![Screenshot 2021-08-09 at 13.29.52](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/6/6685963695594e3e5de1eab571cafbfc6464f5e4.png)

I had an idea to use something like this later to add this list/object to the DVL when start the app:  
(I haven’t tried this yet, its only an theoretical idea)

 ![Screenshot 2021-08-09 at 13.31.10](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/5/4508993427501b476eee5dc0b056f5843abd7566.png)

So, this is why I want to be sure that the variable is containing what I expect (all the entries made in the app so far).

If you have any tips to me I would gladly try it out!  
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:** [August 9, 2021, 12:09pm UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/19 "2021-08-09T12:09:09Z")

</div>

So, for me this block feels right when entry new data:

 ![Screenshot 2021-08-09 at 14.05.10](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/4/b4ad45ffa16160021e651d6861080638b4a041a9.png)

And something tike this feels right if I want to see what’s in the variable:

 ![Screenshot 2021-08-09 at 11.29.49](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/c/3c9b96ccc76cb9dd6d9b1ac1dacfece523af3a2d.png)

…Only that this will show only this current entry in the label, not this AND other entries that’s been made (which is what I want)…

If I do this, it will do exactly what I want but only for the first entry…

 ![Screenshot 2021-08-09 at 14.19.00](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/c/3c8a62f7c2e07e52d6bc61b3eacad858659f0a6a.png)

---

<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:** [August 9, 2021, 12:30pm UTC](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198/20 "2021-08-09T12:30:10Z")

</div>

If you want to show all the entries in a list then you have to loop through all the entries. Use  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/5/a5c4c53a0286084821ebf840bcaff36b1f845c50.png)  
To go through the entries one by one.

The other way is to add them as a single entry in the list from the start instead of making it as an object with two properties.

[Next page](https://community.thunkable.com/t/saving-two-properties-of-an-object-to-an-array-in-an-variable/1439198.md?page=2)
