cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing count directly via binding syntax

mingkho
Advisor
Advisor
0 Kudos

Hi UI5 experts,

I have a very simple scenario where I want to show a total entries of a collection without doing aggregation binding on a list/something similar.

e.g. I want to show summary page with total Products (the list with all products will be in another page)

Is there a way to get this value via databinding syntax such as

<Text text="{/Products/$count}"/>

Please note that:

I want to avoid calling OData request directly to get the $count and then programmatically set it to the Text control.

I also want to avoid having to bind the /Products collection to a list first and then get the total length, because like I said, all I want to show is count, so retrieving the whole collections seems like an overkill.

If it's not possible to do this via databinding, then why is it not supported? this seems like quite simple scenario that makes me wonder why it's not supported?


I have actually tried Expression Binding on the newest SAPUI5 1.28.5 but it doesn't support it on collection level

i.e. {= ${/Products}.length} doesn't work

Regards

Ming

View Entire Topic
former_member182372
Active Contributor
0 Kudos

Don't think there is a declarative way to do it, only programmatically. And to try to answer "why", I would guess because it is DATA binding, not METADATA binding.