Update resource query input parameter from table row button click

Pressing a Hide button on a row of a table should add that user's id to an array hiddenUsers which won't be seen in the table.

I have a hiddenUsers array, looking like ['userId1', 'userId16'], as an input to an imported resource query. When the table loads these 2 users are not shown in the table. This already works today. For each table row (representing a user) I have added a "Hide" button. In its onclick handler I added a JS query to update hiddenUsers but didn't get it to work, logs looked correct but hiddenUsers was never updated. Is it even possibe to update an input parameter?

If not, is there some place to store hiddenUsers in Retool where it will be remembered between reloads (for all users)? I've mostly found stuff about Store temporary data with variables and localStorage | Retool Docs which obviously won't work. Storing in a database (Retool's or my own sounds like over complicating things). Any tips?

Hi, if hiddenUsers is an app variable, you should use a Set variable event type that would be a straightforward solution. Otherwise share your code so can look if there is an issue in your query

Could you point me to how to create an app variable? The current hiddenUsers is this (ie. in reality called caregiversToHide):

If you want to update your hiddenUser array in the database table I would recommend to write a sql query instead to update with newly added users.

Then you could create an app variable that would be updated when users click the hide button and pass the variable value as a additional scope parameter to your SQL query - so your table's data would update automatically each time the variable's value changes.

App variable sounds like a temporary variable?
Is there no way of keeping the state of hiddenUsers in Retool (without using db)? Which still is accessible for all our Retool users.

Not that i know of personally the best option would be to save it to a database.

1 Like