How to use on-device storage "create record" without ID?

Following this guide I coundn’t get this to work (Power-up: Offline Storage - AppGyver).
When I make the “create record” node I do not have the option of inputting an ID?
But the rest looks just like in the tutorial, have the way of doing this changed since this tutorial?

BR

Hello here is my problem, how do I get around this change?
When I look in the debugger, the flow value is just a long randomly generated string.
I don’t see how I can connect the created record and reference it later if I can’t set it with the ID somehow?

Hi @Hampus_Bergman, the implementation of the on-device storage has in fact changed and it’s not fully compatible with the tutorial anymore, since the ID will be assigned randomly. You can go around this issue by using the “Set item to storage” and “Get item from storage” flows from the marketplace. They let you save and fetch data with a predetermined key, like the previous implementation of local storage did. You can use these flows to store either the ID of the “Settings” record that you want to fetch, or the whole record itself. :slight_smile:

Hope this helps you get forward!

2 Likes

Hello,

It has not helped I am stuck at this stage still.
I cannot figure out how to pass the value received from “get item from storage” to set an app variable.
In this example program I just have a app variable of text type connected to an input field.
And I want it to be persistant when I close and open.
But I can’t use “output value from another node” so I guess I need to use some formula, but I cannot find any examples for guidance.

Hi @Hampus_Bergman the formula to use is outputs["Get item from storage"].item :slight_smile:

I tried that 10 times and didn’t get it to work… :sweat_smile:
I have no idea what I did differently, but now it works!
Thank you!

1 Like

Hi Mari,

Is there any size limit for the “Set item to storage” function? I tried putting small amount of data and it works. But when I tried putting 20,000-30,000 data, it doesn’t work

Hello

Why should it be so complicated to get the ID of a record? Why can’t we set the ID we like?

Furthermore, something has changed which brings compatibility issue. I was not able to pass the ID through item storage flow functions.

The “create record” function gives you a ID in the form of a text.
You set that text into an “item to storage”.
But when you use “get item from storage”, the output is of “any value type”.
And “Get record” node requires a “text” type in the ID input.
So… You can’t connect them through an app variable, like I used to do.

I finally got to make it work thanks to the above formula : outputs[“Get item from storage”].item that allow to bypass the compatibility issue.

I short, what I was able to do, I am not able to do it anymore. Appgyver, why change things when they already work? I have, again, lost hours of work because changes were made without foreseeing consequences.

Again, why make it so complicated to store and retrieve the ID of a record??

Hi Mari, can you post a screen shot of the set/get on storage logic. Everyone says this but never shows how it fit’s in with other logic. Thank you

Hi Greg,

I agree it is quite complicated since you have various levels of abstraction. You have to create a record, get the ID, set it in the storage, then when you need the record, you have to retrieve the ID from the storage before you can retrieve the record thanks to it.

So first you create a data resource in the data tab. The ID property is always there. Add a property type that you need.

Then you use the “Set Item to Storage” logic. Give a key to the item that you will remember.
You bind the value stored to “output of another node”, select the “create record”, then “ID”. So that you will store the ID to storage.

(if you need to can immediately pass the value put in the record in a variable, using “output of another node” option)

Then, the step where you need to retrieve the record:
Use the logic “Get item from storage”, with the key you remembered.
Then on the first output you link a “Get record” logic, select the data resource.
In the ID, you put this formula :

outputs[“Get item from storage”].item

It will get the ID from the storage.

That’s it, you can further use the value you put in the record in app or page variables.


That’s my way to do it. I don’t how if others have other ways.

Hope that helps