cancel
Showing results for 
Search instead for 
Did you mean: 

XSODATA IS NOT WORKING WITH 'COUNT' AGGREGATE

Former Member
0 Kudos

Hi Experts,

I am facing problem while activating below xsodata with aggregate by 'count' on the analytical view "ENROLLMENT_BY_RACE".

Details:- "NUMBER_OF_ENROLLMENTS" has been declared as measure in my analytical view.

Please find the code below:-

service namespace "gokul.data"{

"_SYS_BIC"."xoriant/ENROLLMENT_BY_RACE" as "bydynamicrace"

       key generate local "ST_ID"

        aggregates always (COUNT of "NUMBER_OF_ENROLLMENTS");

}     

Please find the attached file for error message appeared on activating the file.

On the similar lines when I am trying other aggregates function in xsodata those are working fine(like sum,max,min).

Appreciate help on this.Thanks in advance.

Regards,

Gokul Dighe

+91-8806668229.

Accepted Solutions (0)

Answers (1)

Answers (1)

pfefferf
Active Contributor
0 Kudos

Hello,

"count" is no valid aggregate function in this context. See Developer Guide chapter 7.1.7 (http://help.sap.com/hana/SAP_HANA_Developer_Guide_en.pdf).

Best regards, Florian

Former Member
0 Kudos

Hi Florian,

Really appreciate your prompt help.Also, would like to know is it mandatory to define aggregates when calling Analytic view in XSODATA service. I tried multiple combinations with XSODATA file in context with aggregates like sum,max,min.If I doesn't give any aggregate in XSODATA file I am not able to call the Analytical view.In fact I don't want any aggregate like avg,sum ,etc.I  want the exact count|(NUMBER_OF_ENROLLMENTS) from Analytical view  which has been declared as a measure in my Anlytical view with aggregation "SUM".

Now when I am calling the Analytic view:-"_SYS_BIC"."xoriant/ENROLLMENT_BY_RACE" as "bydynamicrace",  forcefully I need to define aggregate function on "NUMBER_OF_ENROLLMENTS" ,if doesn't define view is not getting call( null in JSON response).

Is there any way to call this view and at the same time I should get the measure values without aggregating on it(like sum,max,etc).

I am interested in getting the count of "NUMBER_OF_ENROLLMENTS".

Thanks,

Gokul

pfefferf
Active Contributor
0 Kudos

Hi Gokul,

I think I didn't get it right now, what the target of your question is?

If you want to have the sum over all NUMBER_OF_ENROLLMENTS then aggregation function sum can be used in the OData service description.

If you want to have the number of aggregated result lines (independent of the number in NUMBER_OF_ENROLLMENTS) you can also use aggregation sum in the OData service description. But the number of line you can determine with the additional URI parameter "$inlinecount=allpages". Than the response will contain a counter result for the number of "lines". I would recommend to add also the parameter "$top=1" to avoid unnecessary data transfer (-> "... .xsodata/bydynamicrace?$inlinecount=allpages&$top=1").

Regards, Florian