Is there any way to filter a list returning zero correctly as 0 and not as nothing?
I need to create a list to give me the count of existing items that fulfill certain conditions (using “filtered” and then “grouped by”). Now that works perfectly if the count >= 1. But if the count is zero it returns no value instead of zero.
e.g.
if the correct results would be: 17, 5, 2 0, 0, 8
using filtered:count I get 17, 5, 2, 8
Didn’t find anything yet in the documentation or forum, but still hoping for a facepalm “so easy” solution…
UPDATE: Interestingly the checkbox feature to “not skip empty groups” within :grouped by exists for dates but not for other values. I guess this would be exactly what I need.
I would not know how to use such condition (if empty) in this context.
Let me explain:
There is a list of Things who have each a list of related Things that have multiple fields each.
I address the list of things with :filtered to extract the elements I need (gives me a list) and then use :grouped by another element + aggregating for count to create the list of counts I need.
Works like a charm but skips zero values like described above.
This might not answer your question for your exact scenario but is tangentially related:
Perhaps you could use the “:defaulting to” feature and enter a value of zero. So, when your filter returns nothing, a text value of 0 will be displayed. I do that for some reports in my app because it looks better than just a blank space.