Best practice to determine if query was executed

If there are multiple interlocking table components, an error may occur when the web page is initially displayed depending on the execution timing and speed of the queries set in the tables.

I'm building my own JS and handling errors, but I'd like to know the best practice to do the following in consideration of future development stability.

  1. How to determine if a query has been executed
  2. How to determine if a query results in more than one record

@jhoshito This is a very broad question without a lot of context - if you can provide more details, I am sure the forum will provide a lot of ways to achieve what you are looking for.

Hai, @ScottR.
Thanks for your advice.

I'm trying to implement simple CRUD processing of DB tables with Retool. *Our DB is Postgres14 by Google CloudSQL.

Since Retool will cause performance degradation as the number of screen components increases, we are thinking of implementing CRUD processing only with table components.

However, I know retool table component's standard function, some times, does not work well when the set query result record is 0. (For example, about add button, tag(dropdown) does not work)

So I descrived JS like attached image, to pass the dataArray parameter which has the layout of the query result if the query result has 0 records, otherwise I pass the data parameter.


But I don't think this is the best way.

Because we are using a custom field (fcid) in our DB table to check the query result count . And it does not cover the case where the query is not executed.

*Our DB data model always has a uuid item with the name "fcid" as a primary key.

From this background, I would like to check whether the query is executed or not and the number of records using the parameters and functions provided as standard by Retool.

Or maybe,, we just need to figure out how the table component's CRUD functionality works well without doing this.

I hope the above is a proper answer to your comment.

Hi @jhoshito !

I'll gladly assist you with this!

For the JS ternary, what does dataArray return?

I'm curious to know more about your app! Would you mind writing into support chat and we can take a deeper look?