Hide query if empty?

Hi,

is it possible to hide a query block if it is empty?

Hello @Jonas,

Yes this is possible using the Has Items condition, although @JuGa has reported a bug that applies to the Query block → Bug with "has items" visibility condition - #7 by JuGa
While this is being investigated further, you can apply this condition to the Query Template block or any other block inside the Query block.

Cheers,

so the condition is valid in all the blocks located inside the query block? that is good to know, thank you (I don’t think I tried assuming that it was making more sense to put the condition on the Query block itself in order to hide everything inside at once)
thank you for the info!

Hello Louis,
thanks for your answer! It turns out that I ran into this bug as well. Since I want to hide a heading based on the visibility of the Query Block, hiding the Template is not enough. So I’ll just wait for the fix.

ok so
as a workaround
I placed a has_items=true condition on the heading, placed as a child of the Query block, before the query template, and it works!
As the query template doesn’t display anything when the query has no result, it does the job (not the best though ahahaha)

2 Likes

Thanks a lot, @JuGa! I will try that.

1 Like

Thanks for the tip, perfectly working for me!
You spared me a lot of headache :slight_smile:

1 Like