Complex RG Logic: Bubble Limitation?

I’m stumped. For the first time since my project, I fear I have have finally met a limitation of Bubble. Prove me wrong! Please!

A RG within my app should display all “things” (Activity Goals) which have been added within the date range selected, grouped by “Activity Goal ID” with a couple of different aggregations. The date range options are: Today; Current Week; Current Month; Last Month; Current Year.

The above logic is simple enough, and is already in place. Here’s where it gets tricky:

EXCEPTIONS TO THE ABOVE RULE:

  1. When “Current Week” is selected, all Activity Goals with a “period” value of “Monthly” which were created within the current month should ALSO display in said RG.

  2. When “Today” is selected, all Activity Goals with a “period” value of “Monthly” which were created within the current month AND all Activity Goals with a period value of “Weekly” which were created within the current week should also be displayed.

NOTE: The above explanation of logic refers to which activities should be displayed within the RG, not necessarily the aggregation values displayed within each RG.

The trouble that I’m running into is that the “Conditional” logic should essentially function as follows (using Current Week) as an example:

When: {date range} is “Current Week”

Data Source: Search for My Data Type:grouped by Item ID

Where the search is constraints are:
User ID = current user
Created Date > start of week
Created Date < end of week

— AND —

Data Source: Search for My Data Type:grouped by Item ID

Where the search is constraints are:
User ID = current user
Created Date > start of month
Created Date < end of month
Period Field contains “Monthly”

I understand that the above outline (the use of multiple “Data Sources”) is not possible. I’m looking for creative solutions, for how else I can accomplish the same or VERY similar result.

Your help is greatly appreciated.

Ben.

@romanmg, any thoughts?

@ben13 A test page might be helpful

@ben13 As long as you are searching the same data type, you can combine multiple searches using the ‘:merged with’ feature. (i.e. Do a search for My Data Type:merged with Do a search for My Data Type:grouped by Item ID).

2 Likes

Dude. Excellent! This is my first Bubble app. I’ll give it a go and get back to you!

1 Like

@eli , that worked…but unfortuantely it slows the processing down to the point that it’s not an option. The speed at which the RG updates (based on the creation of new things) is an integral part of the user experience. By adding the additional “merged with” functionality, we lose that cool, clean user experience. Thanks for the input. Let me know if you have any other ideas.

Hey, that is unfortunate. There may be other ways to make this happen but another way you could do this would be to add another field (or several) to your data type for the purpose of your searches.

For example, you could add yes/no fields as such to indicate which searches that record should appear in:

Search Weekly: Yes/No
Search Monthly: Yes/No

Then your search on Current Week could look like this:

User ID = current user
Created Date > start of week
Created Date < end of week
Search Weekly = Yes

You might have to add a Due date field as well to get around needing separate date constraints but I’m confident you could structure your data in a way that will serve your search needs if the :merged with is not an option.

I sure appreciate the help @eli. What a great community forum. I’m sure your most recent suggestion would work, but I opted to go another route that also did the trick. Thx.

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