Stored variables

I love the stored/cloud variables-- it something I’ve been pushing for a long time and have talked with Mark about. I think it can be a game changer for beginners and building apps with persistence and shared data.

I started playing around and am having trouble with building a simple noteTaker app. I have defined stored noteList but when I try to insert an element it crashes (well, the op doesn’t work). I tried first setting the stored noteList to empty list, but that didn’t work either.

Are there any samples, especially with list data?

2 Likes

I played around some more, I think the insert at is not working with stored variables. I was able to create a list with the list block, and its stored persistently, but I can’t add items to the list

I am still using the variable created with the procedures for list items

1 Like

Hi and thanks. What do you mean by “the variable created with the procedures for list items”?

Sorry you are having issues but I am glad to hear that I am not the only one having this problem. I can’t seem to modify any list stored in a variable. That includes adding, removing, or modifying any list item.

@Mark Are you aware of this issue?

Sorry, Dave. That’s a known issue. See this post and some of the following ones for more details from Paul.

-Mark

Hi Mark. Good to know, thanks,

Dave

@AcrobatEpee means this:

The two upper purple and orange blocks show the solution. To create more variables please click on the gear-symbol in the upper left of the purple block.

1 Like

Yes, @User81 has exactly what I said ! The time I figure out how to use the new variables, that’s how I am doing it :slight_smile:

Thanks and sorry for the delay :slight_smile:

thanks, much appreciated,

Dave

Seems like insert at , is not working properly, in other post i read , the Block Need to be inside a loop to work

What do you need ? I failed to understand sorry :confused:

The current issue has to do with the way that we store the new types of variables. We aren’t properly storing modified lists (or objects). We have an imminent release that will fix the issue in the majority of cases and are working on a complete fix that will be rolled out soon after.

-Mark

Great, this is fantastic.

How do you initialize, say, a stored variable, to be defined as a list?

One way is to first run the app and set the stored variable to empty list. Then modify the blocks of the app to expect a list in the Screen.Starts.

I’d check to see if the stored variable is a list, but I dont think there is a way to ask if a variable is a list. And I can’t insert things into a variable unless it is a list.

Thanks,

Dave

To initialize a stored variable as a list, I’d set the stored variable to an empty list if it’s null when the app starts.

Unfortunately, we don’t have a block to tell if a variable is a list.

In Thunkable X, you can define the value type of any variable. For the list, use such a block.

%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5

An empty list is , an empty object {}, a non-empty object contains { and }, an object in the string representation [object Object], not a number - NaN, etc.

If the brackets can be used inside the values, then the definition condition of the list needs to be clarified - the first character = [ and the last character = ]

Hi Paul. I tried the code attached and can’t get the “notelist=null” to evaluate to true.
I also tried "notelist=“null” because there has been a bug with LocalStorage such that that
would work, but that didn’t work either.

Thanks,

Dave

Try force quitting your Thunkable Live app and re-opening it. We pushed an update to the app that requires a force quit to apply ~48 hours ago.

I just tested your code on my up-to-date devices and it works for me (and it didn’t work on a device on the previous version).

Hi,

The “null” block has usage specifics and does not work as many people think. Try a text comparison instead:

if join <- stored Notelist = “null”

Although the comparison with the null block should work.