Programatically restoring server tables to screen tables

I am having a new problem that I didn't have before,

When I set up my restore code for a screen table I usually have something like the what is shown below.

And if I wish to restore data from the server table to the screen table with code, I would use the same code. i.e.

select * from Invoices01b

This code does not direct the data to a particular screen table. But it has worked in the past.

Is there a new way I should write this code to get this to happen properly?


Hi @mdsmith1, it looks like we are filtering rows to get the ones where the "Userno" column matches a value we have in localStorage. Although this query may not be the "Data source" for a table, it should still work in isolation. Perhaps the value for that key in localStorage has not been set yet. Could you share the part of your app where the "Unerno" key gets set in localStorage?

Hi Paulo:

I am providing 2 screen captures to show how Userno gets established.

It comes when the first screen is opened.


Thanks for sharing! Try removing the space between the function name and the parenthesis:
localStorage.setValue("Userno", 1000)
This may be causing the issue, the value may not be set in localStorage with the space in between.


Thank you for your suggestion.

It made no difference.

I have looked under all 3 tabs and cannot find a way of making it stop.


You are welcome! Let's try something else:

On the "RestoreInvoices" query, hover over "{{ localStorage.value.Userno }}" and let's see what the value is evaluating to. Then, copy the value and add it manually (replace the current localStorage reference). Do we get a result then? :face_with_monocle:

It would also help if you could share the table schema with us. This way, we could check if the column name has a different name on the db, maybe "user_no" or "user_num" (column names are usually written in "snake_case"). :snake:


The RestoreInvoices part of my code now seems to be working OK.

It has switched over to another problem about "SaveChanges" which is described elsewhere in the blog.

Thank you for your thoughts.

Something is wrong with my communication to and from the server.

I am now finding that I have to push some buttons twice to get the calculations to work. Its pretty hard to describe this on the blog because there is so much code. I think I will have to work with this myself and see how it evolves.



You are welcome! If the same app is handling too much logic, we could break it into multiple apps. This improves performance and avoid bugs that could be caused by a complex dependency chain. It may not be the case though, it is hard to tell from looking at a few queries.
If you are still experiencing these issues, feel free to join us during Office Hours, we are happy to take a closer look. :slightly_smiling_face:

My app, called "Refresh" has to look at tax rates, prices, quantities and line order and recalculate line totals and grand totals. Some figures are presented in a table and others are shown in text fields linked to local storage. All together it takes 11 apps.

The calculations are not complicated. One of the problems is there are 2 screen tables and I think Retool has problems with sending data from the server to the correct table when there are 2 screen tables.

Anyway, after a lot of trial and error, I am now getting the right updates in both tables.

The tables worked fine 2 months ago and now I have had to do a lot of rewrites to get them working again.

This experience has made me question the stability of Retool but now that things are working again, I will stay with it.

Thanks for reaching out.


Thank you for sharing your use case and feedback, I will pass it a long to our devs.


One thing that would really help is code for taking a value calculated with MySQL and putting it directly into localStorage.

For example, suppose I have developed a variable @TTotal as below.

SELECT @TTotal:=SUM(TOTAL) FROM Invoices01b ;

For me, I put that value into a MySQL Table with:

update Invoices01b set GRTOTAL = @TTotal ;

Then I save the m MySQL table to a screen table with a restore command:


Then I put the value from the screen table to localStorage with:

localStorage.setValue ("TTotals",;

It would be great if there was code for transferring a variable calculated with MySQL and putting it directly to localStorage,


We can do this by adding a Success event handler to the SELECT query: