Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EntityDataSource where association count > 0

I'm trying to get Items that has at least 1 Chart, Items and Charts have a 1 to many relation.

I tryed this :

<asp:EntityDataSource ID="EntityDataSource1" ContextTypeName="Entities"
EntitySetName="Items" Where="Count(it.ItemCharts) > 0" runat="server" />

But i get the error message :

No overload of canonical aggregate function 'Edm.Count' is compatible with the arg...

How do I do this without using code behind?

Thanks for the help!

like image 580
JoRouss Avatar asked Dec 06 '25 05:12

JoRouss


1 Answers

You should use EXISTS to determine whether a collection/association is empty:

<asp:EntityDataSource ID="EntityDataSource1" ContextTypeName="Entities"
EntitySetName="Items" Where="EXISTS(it.ItemCharts)" runat="server" />
like image 102
nemesv Avatar answered Dec 07 '25 22:12

nemesv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!