Deep relationship calculation bug

Hello everyone!

I got a problem which is pretty hard, but I am almost hundred percent sure I did the right thing.

First of all let me explain my database structure:
I have a collection called ships. Those ships complete journeys (one to many relationship). Each journey has multiple waypoints (one to many relationship).
In those waypoints the user can fill in it’s fuel consumption since the other waypoint, so add those consumptions to eachother and you will get the total consumption for the whole journey.

I want to show to total fuel consumption of last year per ship. So what I do is in a list of ships is the following: Current ship > Journeys > Waypoints > Consumption > Sum. It shows nothing!

So I rechecked my database and it clearly shows the ship did one journey, in that journey where 3 waypoints with all a bit of consumption.

In order to test where the fault is I tried to just show the total amount of journeys the ship did, it correctly said 1. (Current ship > Journeys > Count)

Then in order to debug the problem I made a list of journeys, in that list it showed the number of waypoints (3) correctly, and the consumption. (Current Journey > Waypoints > Consumption > Sum)

But, when I try to do the exact same thing, but one level higher (so on the ship level, Current ship > Journeys > Waypoints > Consumption > Sum) it doesn’t work again!

The problem might be in the fact that with the longer string (Current ship > Journeys > Waypoints > Consumption > Sum) it has to first calculate the amount per journey and then add those values together, which might just not be possible yet.

I hope I informed you guys well enough to help me out on this one, if you have any more question please feel free to ask them!

1 Like

So, does anyone know if this just simply doesn’t work in Adalo, or did I make a mistake? :pray::raised_hands:

Without seeing it and playing with it, I’m not really sure. However what if you do (consumption-> average)xJourney count.

Would that work?

1 Like

Seems to also not work, because it doesn’t show any average consumption. That’s why it shows 0 now.

I see where it goes wrong. It also doesn’t show the waypoint count (Current Ship > Journeys > Waypoints > count).
But it shows 3 waypoints in the database:

I’m guessing it doesn’t like the fact that you are asking for Waypoint count, and it doesn’t know which journey you are asking the count for. Whereas with journey count Adalo knows that is for Current ship.

Could you have a consumption field under each section. So Ship has a consumption field, Journey has a consumption field, and waypoint also. Then when adding a new consumption to the waypoint, it also updates journey fuel consumption + X, and ship fuel consumption + X.

2 Likes

Yeah, I think I have to do that. Really disappointed it doesn’t work this way, since this looks so clean :heart_eyes:

It’s just a step to far. It has to sum up the consumption twice now. First it has to sum up the consumption of all waypoints in that particular journey. Then it has to sum up that sum again.

I really hope this will be possible in the future, since I can select it.