I understand that Bubble can’t sort by a calculated value on the screen yet.
I’m wondering what it will take to sort a calculated value in Bubble, possibly through the use of external API’s, or anything else for that matter.
There are so many applications out there that sort by calculated values, but this seems to be one of the very few sticking points at Bubble.
I’m also wondering if Bubble has any plans to sort this out so that we can sort some way, possibly by storing the values in a cache of some kind, and then sorting the values/entries in a repeating group from there?
Looking for any solution at this point, or assurance from Bubble that it’s being worked on, which would be a great thing to hear!
I’m curious about this, I assume you have an idea on what you’d like to achieve here, can you give us an example of what you’re thinking because I reakon there would be a way, most of time there is!
yes this is a pain, if you search through the forums you will find previous threads. Advice seems to be to do your calculation then store it back to the database, but if someone knows a better way please tell me I’m interested too!
In my latest effort I was saved because I want to sort on the distance between two addresses. If you happen to be wanting this specific calculation, you can do that by sorting on the Address field and Bubble gives an option to sort on distance from another address.
I’d love to have a solution for this @NigelG currently totally stuck.
The values are calculated and displayed on the screen based on the inputs of the user.
Plane tickets depend on the distance flown between two points calculated against the cruise speed of the aircraft and further against the hourly operating cost of that aircraft, as set in the database.
The only values in the database are hourly operating cost and cruise speed and the 2 fixed_addresses (geo addresses) of the two points in the itinerary to calculate a distance.
So i’m trying to sort flight tickets, by the lowest to the highest, based on the user inputs.
How can I achieve this either inside or outside of Bubble??
If I understand correctly, you have managed to calculate the distance between two addresses. if so, may you please help me out with that, I have been struggling with getting the distance between two addresses right.
Convert the 2 addresses to geo addresses then use standard bubble functions to find distance between the two points. There are lots of threads on this.
The price her hour is in the database, yes, but that doesn’t help, because the current position of the aircraft is used to calculate the total flight time and ticket price.
So if you are requesting a flight ticket from NYC to London England and the aircraft is positioned in Chicago and has a home base airport in Milan, IT the calculations are as follows based on the distance/time*hourly rate of the aircraft -
leg 1 - Chicago to NYC (pick up client in NYC)
leg 2 - NYC to London (drop client off in London)
leg 3 - London back to home base in Milan Italy
All of the above is calculated by Bubble to get total distance and calculate it against the saved hourly rate for the aircraft. And at that point, it must be sorted from lowest to highest price.
Yes it would span outward from nearest to the departure city/airport, as that would result in the lowest price, but the total results can be over 5000 in the database, as you can get specific with the aircraft type and request a special aircraft that comes from, say, Dubai to NYC, NYC to London England, then back to it’s base in Dubai.
So all of the aircraft need to be eventually parsed and calculated and then sorted. It could be done in paginated format (just an idea) or 100 entries at a time, but it still doesn’t help because bubble can’t sort the calculated values it seems.
Any way I can get this done i’m open too - such as an api, or anything else. I just can’t figure this one out.
I have been trying to get this right but have not come right. I tried many options for what you have mentioned above. This is one of my approach below. Please advise where I got it wrong.
I have saved the addresses using the geo-addresses.
Parabola would work well, i agree, and I had tried them, but they suggested it wouldn’t be quick enough and isn’t geared toward such speed.
I will investigate Airtable - something tells me i’ll run into a speed issue here as well - I just wish that we’d have input from the bubble team on what this will take to achieve. Sorting by a calculated value is such a sticking point based on the forum posts and feedback.
@NigelG besides writing back to the database I’m aware of pulling a value out of the repeating group using bdk plug-in (haven’t tried it.) What others? Seems like this would be a handy topic to build mastery of the workarounds.