Building Connection routes from routes data type

I Have a Routes data type. From, To and Rate/Kg are the data fields.

When a user comes and search rate for sending 50 Kg box from location X to location Y.
Can have following scenarios:

  1. X and Y are there in one data row, no issues, I can do it
  2. X and Y are not available in one data row. But they are available in different data rows. Now I need to combine them to gather to get the rate.

E.g. Data rows in data type are:
X to Z rate 1 USD/Kg
Z to W rate 0.8 USD/Kg
W to Y rate 1.2 USD/ Kg
From this I need to drive X to Y via Z, W is 3 USD/Kg

How can I do it in bubble?

1 Like

Is this a question related to a project you’re actually working on or a theoretical one?

Most postage APIs would do this automatically?

That being said if this is your own dataset you could create series of workflows to resolve it, but anything more than 3+ segments will start to become hard to cost optimise etc I would think. Personally I would outsource the calculation to an AI model and then cache the answers (assuming segment price stays the same).

So if A-B has a direct price, return that.
If A-C doesn’t have a direct price, but there is a saved multi leg price, give that.
If A-D has neither, then send it to your AI model to calculate.

This is a actual project I am working on. I made a working prototype using bubble. I have got stuck in few places, one of them is this.

I have to decide, whether I can develop the product fully in Bubble or a hybrid model or totally on some other languages

Nice, I’d suggest using an AI model to calculate the optimised route as above,:slightly_smiling_face: