Get Item from Storage - Output Value

Quick, maybe dumb, question. I am trying to use Set Item to Storage and Get Item from Storage to save variable values for later (need these values to persist through app restart). If I set a value to storage (e.g. a name “Andy”), is it possible to get the name and set it to a variable with Get Item from Storage? Or can you only get True/False from Get Item from Storage?

I have been trying and trying to find a way to save values and load them on restart and CANNOT get it to work.

Port 1 has 2 output variables.

Item – any value

Item in persistent storage under the given key.

Item found? – true/false

Whether or not an item was found using the given key.

Examples:

false

If you want to assign the value of retrieved item to a variable, you just tell the logic to

outputs[" Get item from storage"].item

1 Like

OMFG Thank you! I have been struggling with this for AGES. I just did it and it worked :smiley:

If anyone else comes across this thread, here is what worked for me:

When attempting to set the variable using the output from another node, unless your variable is true/false, it won’t do it directly (you can’t bind the assigned value to output of another node). Instead, in the set App Variable node, under Assigned Value, you have to bind it to a Formula. When you go to formula, look for “Output of another node” under variables on the left and then choose the .item option from the correct node to get the variable.

I did a test last night and it was working. Now I can’t get it to work again.

I use set item to storage to save a text or number variable. As far as I can tell, that works fine. Then I use get item from storage. I was able to confirm that it is finding an item. But when I then try to set app variable value using formula outputs[“Get item from storage”].item, I get the message in the formula page that “Type “json” is not assignable to text type”, and the app variable value is set to null instead of any value.

Where am I going wrong?

That is OK. As long as you know what you have stored in that item and process it properly, you can dismiss the message.

I think my app is broken. I’m only getting null from Get Item From Storage nodes. I checked, and even if I put in an item key that can’t have anything stored under it, the node is still evaluating as if it found an item (port 1). I’ve submitted a bug report.