i need some help for sorting of count.
i have 3 records with Activity Type “Onsite”.
i want to display in VISITS the average of visit, so march 13 is 3x but i want to display is 1.
i spent 2 weeks in this problem LOL. i hope you can help me guys
thanks in advance!
i hope someone will help me on this problem
I think they lack of replies may mean that we’re having a bit of trouble understanding what you’re trying to solve. Do you mean that the VISITS counter (showing 3 in your image) should show all the logged visits on that date (March 13th 2020?)
So that if five people visited on that day, the number should be five?
I wonder if it’s the “grouping” feature that is needed here? So if that “visits” field count is showing it’s value based upon a count of the RG’s items, then maybe all you’d need is the grouped by visit date added after the count or something. Type of grouping set to day and then whatever the interval and start dates should be.
Bubble is not that great at sorting and indexing by dates dynamically, as it doesn’t let you identify the month and year easily. Here are two different solutions that I would consider:
Saving day/month/year in separate fields
I’ve made a habit of doing this a lot when working with dates. On the VISIT data type, add three extra numerical fields:
These three fields are updated whenever the already existing DATE field changes. This way, you can much more easily set up search constraints based on exact days, months and year, and the search will be quick to finish. This gives a lot more fleixibility in other operations as well (such as show all visits in march, all visits in 2020, etc.
Using a date range
Here’s another approach, if you don’t mind using a :filter on your search:
- Use the value in the FROM and TO fields to generate a date range, and save that in a state RANGE.
Remember that dates and date ranges always include a time, so you can use the *rounded down to: day operator to set the start time (13/3/2020 00:00) and for the TO value you can use Input’s value + 1 day: rounded down to day, plus seconds -1 (which will give you 13/3/2020 - 23:59:59)
- So now you have a date range covering the entire day of 13/3, no matter what exact time the visit was
- Apply a :filter to a search that checks if the state RANGE contains point This Visit’s Date
This will work just fine, but be mindful that :filters can become slow if your working through 100+ entries, as the operation is done client-side.
This topic was automatically closed after 70 days. New replies are no longer allowed.