Show alert IF something occurs, feels like a brainteaser!

I feel like I am lacking brain power to figure this very simple problem out and it’s got me stumped.

My users can join groups, they can say they are Going, Maybe going or Following. When they log in to their ‘My Groups’ area they see the groups they’ve joined.

If they have not had any activity, ie. not joined any groups (either Going, Maybe or Following) I just want to show an alert which says “You haven’t joined any groups”.

This would normally be a peace of cake, just put a condition which searches for groups where Going, Maybe or Following do contain the current user and then hide the alert.

But, here’s the twist …

In my app, if a user creates their own group, they are automatically joined to their own group (they are set as Going) , but this group will not show up in their ‘My Groups’ area because they don’t need to see their own groups.

So, I need to somehow show the alert if the user is not Going, Maybe or Following other groups but discard if they are going to their own group as this should not count as “Going to a group”.

This is one example of what I have tried (with no luck)

As a side issue, when the page loads it displays the alert briefly, before Bubble realises that the text should not be displayed, which looks a bit tacky! I have switched off This element is visible on page load, I’m not sure if that is something that can be fixed?

This isn’t high priority but it’s been bugging me and I wondered if anyone has got a possible solution for the above?

The way you’ve set it up won’t work because it will look for a Group where the Current User is in Maybe, Going and Following all at the same time (it’s basically doing an “and” search). To do an “or” search, in your expression, do a search for Maybe and merge it (using the merge with expression) with a search for Going and merge that with a search for Following, then do your count.

Regarding the message briefly displaying then disappearing, it will take Bubble a moment to do the calculation, so have the message hidden on page load, and only displayed if the search count is 0.

But surely it could be either ‘and’ or ‘or’ because I am searching for users with no activity? So users who are not Going, Maybe and Following would be the same as not Going or Maybe or Following, because unless all three conditions are met we don’t show the alert? That said, I am happy to go with the “or” search.

I don’t understand this, any chance you could show an example?

Ok so my logic should be something like this;

Only display alert if NONE of the following apply:

Search for groups where
Going contains current user, OR
Maybe contains current user, OR
Following contains current user, OR
Going is created by current user (actually this last one is not correct because the alert should show regardless of whether the user has created their own group. I think this condition is a lot harder than first glance, I’ve spend hours on it!)

Your existing expression is searching for entries where a user is Maybe, Going and Following in a specific entry. Because a User can only be in one or none of those categories in a specific entry, the result will be 0. (Kind of like saying search for an animal which is a dog, a cat and a mouse at the same time. The result will be 0 since no animal is 3 things at once).

To do an “or” search using merged with, see this:

Keep your Created By <> on the “Going” search so it doesn’t return/count any groups the user created.

Regarding doing the :count, you may have to fool with it. Bubble evaluates expressions left to right and it’s not always clear at first whether it will apply something at the end to the whole expression. Some potential ways may be:

  1. SearchA merged with SearchB merged with SearchC: count =0
  2. SearchA: count + SearchB:count + SearchC:count=0
  3. Or if you find the above are only counting or measuring the last search, then create a group, and set the group’s Type of Content to number, and set the number as SearchA: count + SearchB: count + SearchC: count. Then put your alert in the group and make the group’s visibility conditional on whether the group’s number is 0.

Thank you once again. The merge with allows the first Search for constraint (Going contains current user), but then the next Search for constraint gives red error.


What does the issue checker say?

From the screenshot snippet you’ve included, the box looks like it’s the type of content for an element, but instead you’ve included a formula for evaluation. That type of formula would need to sit in a condition or the “only when” box in a workflow.

Well I am getting closer I think, I repeated exactly what I did yesterday and this time there’s no red text error!

But, there’s a new issue in that only one merge with function can be used, it won’t allow more. So I have set up the condition like below;

You are looking at the settings for the first Search for groups condition, where you see the second Search for groups condition I have said Created by <> Current user.

Anyway, none of this works, presumably because (as you said) I am doing an “and” search instead of an “or” search.

I am stumped again!

The box you screenshot in yesterday’s post is different. You had it in the wrong place the first time.

You can use multiple merged with. Try it again.

Based on your screenshot, it looks like you are still putting 3 conditions each search. Only put 1 condition in each search (except for the Going search, which will have create <> current user).

I just replicated the process in my sandbox app based on my “Pets” datatype:

Here’s the condition:


The above merges 3 searches. Here they are:

First search:




Thank you for urging me to try again using multiple merged with conditions because it worked perfectly this time.

Thank you for taking the time to replicate the process in your sandbox because it helped me to visualise it. I am happy to say that it finally works!

1 Like