:count returning wrong value in a Search for

I have a conditional using a Search for, but :count returns an unexpected value that doesn’t match with what the debugger shows is found by the Search for. Weirdly enough, it returns the correct value after a page refresh.

Screenshot_1

Screenshot_2

Screenshot_3

Screenshot_4

As you can see in the second screenshot, the Search for doesn’t find anything (it says right there, (empty), yet the count is 1.

This is a privacy issue. Go to the data tab and then privacy to set or delete privacy rules.

Not too familiar with these, I checked every box I could. The issue still persists. All other data types besides User are publicly visible.

The count is correct. Your search constraints look to include User = Current User. You’ll either return a 1 or 0.

The constraints also include completed? = yes, which for the current user and lesson_id, is actually set to no. Shouldn’t that return 0?

I wouldn’t know since i don’t know which UID belongs to whom

There is only one user. All entries shown are for the same user.

That is quite odd. I have seen some unpredictable results with the Bubble db at peak hours. That it works after a page refresh is notable but doesn’t fully explain it either…

Does the issue persist today? If so, I would suggest contacting bubble support. If you can, go into the logs and send them the workflow id of one this is happening for to assist them in tracking it down.

Yes, the issue persists today.

Ahh, your constraint also contains lesson id = xxxxxx You should only have constraints for user and completed?

I’m on mobile and can’t check a debugger but it looks like you are evaluating if the search’s count is 1. If you are then it should return 0 since the search does return a count of 0 and hence the result of your expression is 0.

I need lesson_id too because I’m using this Search for inside a Repeating Group of lessons that each have their own completed? set to yes or no.

You’re right that the Search For doesn’t return any rows in this case, but if you take a look at the screenshot in which I highlight the :count, it says that the count is 1, even if the Search for doesn’t return any rows

But does the final result return the correct value in your expression? If it does then it is probably an issue with the debugger.

No it does not. The correct value is returned only after a refresh or after pressing the button that changes the completed? to no a second time. But weirdly enough completed? has the correct value in the database with only 1 press of a button. The second press/page refresh fixes the return value of the Search for:count.

Hi @tudor.cezar01 , did you find a solution to your issue? I’m having the same problem, unexpected count, while everything seems to be right, and what confirms me it is that when I refresh the number gets right.