Check if Response of Server Connect Query is Empty


#1

Hello again.
How can I check if the response of a server connect database query is blank?
I would like to toggle visibility of a “No Records Found” element based on response of the query. Please help.


#2

Hello,
Select your “No Records Found” element and add new dynamic attribute > display> show > and select your query as an expression.
Click the formatter icon, under conditional select Has Items:

Click ok and then add a ! in front of the expression, so it becomes:

!serverconnect1.data.query1.hasItems() This means show the element when the query does NOT have items.


#3

Perfect.
Could you point me to some documentation where I could understand how these expressions work in context of App Connect?


#4

You can find the documentation here: https://community.wappler.io/c/docs
We are constantly updating it, so slowly we are filling the missing topics…


#5

For anybody in the future who’s interested in this topic - here’s a link to the how-to guide explaining this in our docs: Show a Message when Query Returns No Results


#6

Wouldn’t it be better to use the HIDE attribute and hide it when result has items?


#7

It’s the same :slight_smile:
Whatever you find easier.