Using ODATA 4, I am trying to get an aggregate count of visits for a collection of applications. However, because SyncFusion appends, $Count, $Skip and $Top parameters to the end of my datasource, I am unable to format the query appropriately.
The original query works fine:
https://myDomain/applications/-1/sessions?$format=json&$apply=groupby((MyID),aggregate(MyID with count as Visits))
However, when I try to use it with the Grid, it does not work:
@(Html.EJ().Grid<object>("Grid")
.AllowPaging()
.AllowSorting()
.Datasource(d => d.URL("https://myDomain/applications/-1/sessions?$format=json&$apply=groupby((MyID),aggregate(MyID with count as Visits))")
.Columns(col =>
{
col.Field("ApplicationID").HeaderText("Application ID").TextAlign(TextAlign.Right).Add();
col.Field("Visits").HeaderText("Visits").TextAlign(TextAlign.Right).Add();
})
)
The query is then formatted by SyncFusion as:
https://myDomain/applications/-1/sessions?$format=json&$apply=groupby((MyID),aggregate(MyID%20with%20count%20as%20Visits))/$count=true&$skip=0&$top=12
This obviously does not work because of the backslash.
I tried using the '.Query', but I have been unsuccessful in setting this up properly. For example:
.Query("new ej.Query().apply(groupby((MyID),aggregate(MyID with count as Visits))))")
.Query("new ej.Query().select(apply=groupby((MyID),aggregate(MyID with count as Visits)))")
Can you give me the proper syntax for setting this up? Also, since we work with large amounts of data, the aggregate has to be done via query as it would be unreasonable to download everything for these counts.
Thanks.