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

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.

Any tips would be very appreciated! Thanks!
/ A

1 Like

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

image

ah…ok thanks! I will try this. :pray:

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

1 Like

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

1 Like

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

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

1 Like

See this example

1 Like

Thanks a lot! It works great! :pray:

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
but that gave me Null again…

1 Like

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.

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.

What did you mean by this: Screenshot 2021-08-09 at 11.31.07
Maybe I misunderstood something here…

1 Like

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.

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

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

Thanks!

1 Like

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

ok.

So, I got this view.


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.

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?

1 Like

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.

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

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)

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!

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

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

…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…

1 Like

If you want to show all the entries in a list then you have to loop through all the entries. Use
image
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.