Forum Academy Marketplace Showcase Pricing Features

Counting visible text

Hi,

I have a repeating group that shows a line for different subject and a text “New” when a new message is created for this subject so a sort of messenger. When the message is read the “new” disappear.
Now in the header, I would like to show how many messages are new. So to count the number of “new” that are visible to increase or decrease as the messages are read .
I would like to base the count on when the text “new” is visible because I have multiple conditions to have it visible.

What is the trick to count visible text?

Thank you

I would be putting another field with the messages data “user_list”. Each time a user reads a message it adds them to the list and the count could be based on dosearchfor messages with user on the user_list:count

Means if those messages go to more than one person the provisions are there and the word new can be visable or not based on the dosearch for aswell.

Thank you for your suggestion.

The thing is that is counting the number of new messages per user. So when one user who is part of the subject conversation reads the message the “new” disappear from his list when he reads it and the other users still keep “new”.
But the new has multiple criteria to appear. this is what is causing me the headache.
It works fine in Conditional panel but not working when I dosearch for because I need some kind of variable to count, the visibility of “new” does not work.
I tried to add a hidden input field in the repeating group named “count message” under user where the value is 1 when the “new” is visible and 0 when it is not visible and add it to the “count message” variable when the value change change but it doesn’t work. It doesn’t count or add up all the 1s of the visible “new” text. So if I have 10 visible “new” to add up 10x1 to show this result.

I am stuck.

wouldn’t the “new” be visible based on dosearchfor with the constraint currentuser must be in the user_list, after read they get removed from the user_list on that one thing. the count would be the same except with the :count added to the end of the dosearch for. maybe im not getting something else your saying. i will do up a quick example app now.

ok i have made the example, in this case the only thing you would need to do is everywhere a condition or constraint is Jason or Bob change it to currentusers unique id.

Live: https://new-msg-count.bubbleapps.io/

Edit: https://bubble.io/page?version=test&name=index&id=new-msg-count&tab=tabs-1

Hi Jarrad, I would like to thank you for your answer and taking the time to set an example. It is really appreciated.
Based on your great feedback, I was able to get a solution that is counting. I still need to test further with some adjustments but overall it works.
So thank you very much. It has been quite some time I was trying to find a solution :slight_smile:

1 Like

Not a problem at all, happy to help :slight_smile:

This topic was automatically closed after 70 days. New replies are no longer allowed.