# No Calculation for Third Level in Collections?

@All,

I have three Collections which are linked as

Areas → Schools → Classes

Now, I’m try to calculate total number of classes in a particular area like

Current Area → Schools → Classes → Count

But gives me 0. Even though the Collections has records.

The same is the case if I apply sum to a certain numberic field in the Classes table. But in case of sum it doesn’t even show 0.

So does this not work? If not then why to show count and sum and other functions on these sub levels? If yes, then is it a bug? Or am I doing something wrong.

I read this topic, but this doesn’t seem right.

Can anyone please give some idea or a hint or something??

I just tested this another way and got it to work.

I made a list of areas, counted the number of classes (all) then filtered so the area has to match.

Does that make sense?

Erik

1 Like

@Erik

Thanks for checking it out.

Not sure how you made the relationship. In my case,

An Area has Schools in it. So the Area is related to Schools in 1 to Many relationship. Then a School has Classes it it. So School is related to Classes in 1 to Many relationship.

So first I have Current Area → Then Schools → Then Classes. In your case, seems like you somehow skipped the Schools.

By the way, if I have just one relationship like Area → Schools or Area to Classes or School to Classes then these functions work pretty fine.

The problem only occurs when we got the third level. As per structure of Adalo filters and functions this should work. But it doesn’t.

Hi @scientist ,
If I read correctly, the 3 levels all have a 1 to Many Relationship correct?

I replicated your issue in a list of Areas for example, showing the count of classes it worked for me:

MY result (School 3 is from HAmptons, there is only painting in School 3, there is no School 1 with classes) and rest is in School 2 and 4 that belong to Long Island)

The Filtering

Because the Area is comprised of Schools and Schools of Classes, I used:

The current Class - School - Area name : So all classes from all schools of that Area

And made equal to the Current Area Name

Hope that is useful.

1 Like

@JL_LJ

This is AWESOME man!!

So what i was doing wrong is that I was filtering the schools first, like where you just said All Classes → Count, i was doing it like Current Class → Schools → Areas…thinking that it will join.

But what I got from your reply is that we still use the same logic as we do in regular database query

like count Classes
joining areas/schools/classes
where area is the current area.

This works like a charm…thanks a lot!

1 Like