I'm trying to pass a parameter from a Javascript query to a SQL query. I am using this approach because I would like the Javascript query to call multiple SQL queries.
I've read Scripting Retool and a couple of other forum posts but can't seem to make it work.
This is what I have so far
The SQL query is defined as below and is named users_sql_reset_account_onboarding_state
:
UPDATE "user"
SET current_step = 1
WHERE email IN ({{email}});
The Javascript that calls the user query is defined below:
users_sql_reset_account_onboarding_state.trigger({
additionalState : {
email: users_table_all_users.selectedRow.data.email
}
});
The query executes without error but is not replacing {{email}}
with the actual email. I know this because I replaced the {{email}}
in
WHERE email IN ({{email}})
with some random variable name {{bob}}
WHERE email IN ({{bob}})
and the query still ran with no errors.
How do I pass the email address from the JS to the SQL?
I do not want to set the Disable converting queries to prepared statements
setting.