We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Proper formatting needed for returning OData 4 aggregate count data to grid

Thread ID:

Created:

Updated:

Platform:

Replies:

120027 Aug 25,2015 03:27 AM UTC Aug 27,2015 08:22 AM UTC ASP.NET MVC 4
loading
Tags: Grid
Jim Woods
Asked On August 25, 2015 03:27 AM UTC

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.

Balaji Marimuthu [Syncfusion]
Replied On August 25, 2015 11:12 AM UTC

Hi Jim,

Thanks for using Syncfusion Products.

We have faced the mentioned issue “Backslash is added to the query formatted in Odata V4” in version 13.2.0.30. And it has been fixed in the latest version so if you are using our product version prior to v13.2.0.30, we suggest you to upgrade to our latest version to overcome the issue.

Syncfusion latest version can be downloaded from the following link: 
http://www.syncfusion.com/forums/119866/essential-studio-2015-volume-2-service-pack-release-v13-2-0-34-available-for-download


Please get back to us if you need any further assistance.

Regards,
Balaji Marimuthu


Balaji Marimuthu [Syncfusion]
Replied On August 25, 2015 11:16 AM UTC

Hi Jim,


Please ignore our previous update.

We have faced the mentioned issue “Backslash is added to the query formatted in Odata V4” in version 13.1.0.30. And it has been fixed in the latest version so if you are using our product version prior to v13.1.0.30, we suggest you to upgrade to our latest version to overcome the issue.

Syncfusion latest version can be downloaded from the following link: 
http://www.syncfusion.com/forums/119866/essential-studio-2015-volume-2-service-pack-release-v13-2-0-34-available-for-download


Please get back to us if you need any further assistance.

Regards,
Balaji Marimuthu


Jim Woods
Replied On August 26, 2015 04:53 AM UTC

Thanks for your help. 

Since, I originally added this functionality to my solution using Nuget, I uninstalled my previous version and installed the MVC 5 package that pertained to the latest version (released in August 2015).

Aggregates now seem to be working properly.

Isuriya Rajan [Syncfusion]
Replied On August 27, 2015 08:22 AM UTC

Hi jim,
Thanks for your patience.
Please let us know if you require further assistance on this.

Regards,

Isuriya R      


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;