This is my Users DB:
But when I do the count, it’s always 0.
I don’t know what happens.
Popping in here with a random tip since I noticed the topic title and learned this recently from one of our engineers - try to make a habit of using “
:first item is empty” instead of “
:count is 0.”
If the condition were to fail, the first expression would only return the first item of the search before returning false, whereas the second expression returns the entire search.
This is pretty insignificant on small lists - but as the list grows larger it can have an impact on performance particularly if you have a lot of these operators attached to conditionals.
Obscure note on Sam’s input for other readers; this methodology requires adjustment when utilizing DB returns from an API (such as the Bubble SQL API): the first item can return non-empty even for a count=0 return, one must run a check on an attribute in order to determine true emptyness for a count=0. I suspect this is because Bubble still instantiates/allocates a single row in-memory to determine the DB schema and just leaves it unfilled from the API return. Example:
Risky: DB_API’s: first item is empty
Safe: DB_API’s: first item’s Unique_ID is empty