Problem Overview:
I am working on a nested repeating group setup in Bubble and facing high workload usage due to repeated searches. I want to filter data once and reuse it in multiple conditions without triggering additional searches.
Current Setup:
- Outer Repeating Group → Displays Employees.
- Inner Repeating Group → Displays Billing Run Dates.
- Billing Run Worklogs Table → Stores worklog entries linked to an Employee and a Date.
For each Employee and Billing Run Date combination, I perform a search in the Billing Run Worklogs table to retrieve the corresponding worklog entry. Then, I apply conditional formatting based on the worklog hours:
- Worklog > 8 → Green color
- Worklog < 8 → Red color
- Worklog = 8 → Grey color
Issue:
Right now, Bubble is executing the search multiple times (once for filtering and then again in each conditional statement). This results in unnecessary workload consumption.
What I Want to Achieve:
- Store the filtered Billing Run Worklog entry only once per Employee-Date combination.
- Use the stored value in multiple conditions (e.g., conditional formatting) without re-running the search.
- Optimize workload usage by avoiding repeated database queries.
Questions:
- How can I store the filtered worklog entry once and use it dynamically across conditions?
- Would a custom state work for this? If so, how do I store a search result in a custom state dynamically (without using a button click)?
- Is there a better way to achieve this without increasing workload usage?
Any insights or best practices would be greatly appreciated! Thanks in advance. 
@adamhholmes can you help me how can i store this entry into my custom state without triggering andy workflow?
You can’t…
Custom states have to be set via a workflow.
You could use a Repeating group instead (or even Reusable element’s Properties, if you want to load the data automatically)
Hii @adamhholmes
In my case how can i do that one?
Can anyone tell me how much workload will be used approximately if I have 60K entries in my database and I search for a single entry using constraints?
Hey,
You can see how much workloads it should consume in the manual.
From what you mentioned in your last comment, it would consume 0.3 WU as it is performing a database search and 0.015 WU as it will only return one entry. Total WU: 0.315
Let me know if this is your case
Hiii @julianalonso,
In my case, it’s consuming a very high number of workload units, possibly because I have defined multiple conditions in the Conditional tab, such as:
- If hours are less than 8, show in green.
- If hours are equal to 8, show in black, etc.
Can I fetch the data once and then apply these conditions to the retrieved data, instead of performing a search every time?
Yes, usually what I do is search for the data and save it in a custom state called Data
. Whenever I want to filter this data, i run a workflow and filter the data on the Data
custom state and save it in a filteredData
custom state.
Regarding the high WU, it may be because of that. What I recommend you do is go to the logs, filter on the last hour, do one request and see what is consuming more
2 Likes
I have already seen that the high number of workload is consuming by Do search operation.
Where do you do the search operation. Do you do it more than once? If so, try to do what I mentioned with the custom states in my last post
Yes,I have used more than once.But using custom state i cannot able to load the data automatially.I need to call any workflow.So in my case to store in custom state will not work.
I am pretty sure you can reference the custom state the same way you are doing the search. If not, you can input the data in a repeating group, do the filter in the repeating group, and reference the data from that repeating group
I have tried using a custom state, but it doesn’t automatically store the data. To store data in a custom state, we need to trigger a workflow. However, there is no option in workflows to automatically load data into a custom state. Similarly, when using a repeating group to store data, a workflow is also required. But I want the data to load automatically without manually triggering a workflow.
Then, what I would do to avoid this searches being done (which is pretty weird as if the search is the same bubble should have it), is create a group in the dates group with datatype number and save the search there. After I would reference the data in that group
No, it will still not work.
You can’t really control how and when searches are done in Bubble (at least not easily) - Bubble intelligently (or otherwise) manages that for you (and seems to change how they manage that over time).
Just because you’ve used the ‘Do a search for’ expression multiple times on your page does NOT necessary mean the search is being done more than once (although, in some cases it may well be - and conversely, sometimes a single ‘do a search for’ expression will actually result in multiple searches being done).
The only way to know is to check the network tab in dev tools.
So before spending/wasting any time trying to control when searches are being made with complex conditions and custom states, it’s first vital to understand what’s actually happening on the page, by analysing the data requests in the network tab.
Very often, what you think is happening (or should be happening), will turn out not to be the case.
By anyway, only once you’re certain of what data is actually loading, and when, can you attempt to control that by changing your datasources, adding conditions etc.
So I’d start with being sure of what’s actually happening on the page, and take it from there.
1 Like
I have seen in the network tab that it’s calling these APIs, but how can I know where it is calling the
Do Search query?