Programatically trigger a query without event handlers

Within a JS Query, I have the following:

 const sql = await Promise.resolve(sql_user_id_email.trigger({
    additionalScope: { offset }, // This is where we override the `offset` variable
  }));

Is there a way to just fetch the data from this query within the JS function, but not trigger follow on events which are setup in the event of success?

I'd like to be able to skip the fetch_and_merge below, for example. Almost like the ability to pass a withEvents: false flag when triggering the query.

You can setup a temporary variable and hold a true/false value and default it to true, call it withEvents.

//update withEvents to false to skip fetch_and_merge query
withEvents.setValue(false);
const sql = await Promise.resolve(sql_user_id_email.trigger({
    additionalScope: { offset }, // This is where we override the `offset` variable
  }));

Update withEvent to false before calling sql_user_id_email to bypass the event handlers.



In the sql_user_id_email's event handler you would modify it as above. The fetch_and_merge query would only run when withEvent is true. Then update the withEvents back to true with 1000ms Debounce, so when you normally run sql_user_id_email would execute the event handlers.

1 Like

Thanks lenti, I'll give that a go.

That worked nicely lenti, thanks!