How to return query result to javascript variable?

Hello,

How can I trigger a select query to return results to a javascript variable?

I am trying this:

return qry_if_table_exists.trigger({
additionalScope: {
tableName:tmpTable
}
});

But not working.

Thanks

Hello!

I'm not sure if I understand correctly, but here's how you could save the results of a SQL query to a JavaScript variable (as far as I understand your question!). I added an event handler to the SQL query that triggers a JS query that then saves the selectQuery.data to a variable that you can use in a JS query.

Please, let us know if you have any further questions!

2 Likes

Thanks, it worked.

Great news! Thank you ricky-raven! :grinning_face_with_smiling_eyes:

Looks like for some strange reason the 'results' is not getting the latest selectQuery.data value.

Here are more details Why is query.trigger not using new values of additional scope variable?