Transferring Values to local Storage

I have already been educated on this but when I try this on my own it doesn't work.

The steps I am taking are shown in the screens below. Intelsense says my syntax is good but nothing gets saved in local Storage.

Any guidance would be appreciated.


Screen 1
This shows where I set the value of the current date. This seems to work.

Screen 2
This shows the Success Section

Screen 3
This shows the local Storage App which doesn't work. Yet Intellsense says the Syntax is OK,

Hi @mdsmith1, start with {{}} and look at the object.

For example, with this specific query I have:

Because the name of the key is "@rdate:=CURDATE()", we have to include the whole string when keying into it. Then, the value is an Array so we have to access the first element in it:

Now we have it:

However, if you just need the current's date. You do not need localStorage or a query. Just create a State variable, and set the initial value to:

You can then reference this date from anywhere by doing: {{variableName.value}}.

Here is a cheatsheet for moment.js.


Yes, I just want a single value.

I have tried the moment approach and that is blocked by my debugger

We are almost there! :slightly_smiling_face:

Instead of making a "Resource query" for the moment approach, create a "Variable."
Screenshot 2024-04-22 at 2.50.34 PM

Then set the initial value to what you have.


I have tried that.

The variable feature has no Run or Save capability on my computer. So I am not able to test it.


Remove select @rdata : = from there.
Just leave {{moment().format("YYYY-MM-DD")}}. You can reference anywhere.

For example, if you need it in a Text component:

If you need it as the default value of a Date input component:

Where do you need it?

You can always find the variable in the State tab:
Screenshot 2024-04-22 at 4.42.12 PM

Once we click on it:
Screenshot 2024-04-22 at 4.42.41 PM

I need to be able to work with this.

I have created the variabke

And referenced it with query 10.

It does not compute.



This won't work on my computer.

See the screen captures below.

This is how variable1 is calculated

This is how @rdate references variable1

This is how I attempt to transfer @rdate to storage. It does not work

If all you need is to set it to localStorage, there is no need for a MySQL query. You can just create a JS query:

When we run this query, we'll add the key "date" and the value of today's date on localStorage.

But if you already have it on a variable, you should not need it in localStorage. You can just retrieve the value by referencing it.

Could you expand on where is that you would like to reference this date? In other words, why do you need it in localStorage?


It works !!!

Thank you so much for this.

I really, really needed to get this to work.

Thank you again ! I have marked this as a solution.

I see that you asked about why I need to put this in localStorage. I will send you what I have been working on, I should be able to finish that tonight.


1 Like

I'm happy to hear that, Mike!
You are welcome. :slightly_smiling_face:

OK, I have the app working.

I need to export an .xlsx file with a Name and Date on top i.e. Archive 2024-04-23

We need this so the user can find the files later on.

See below.


This shot shows the Excel File with the header.

This shows a close up of the header.

This shows the code that generates the header. I have used you code to generate "rdate".

It all works perfectly.

Thanks again.


1 Like