cancel
Showing results for 
Search instead for 
Did you mean: 

XSDS - Aggregate

former_member187794
Participant
0 Kudos

Hello Everyone

I am using XSDS to select data from a CDS table. I am using $aggregate function, in which I am trying to send a Column based on the input. I tried with few options and tried to get info online. Did some one worked on this? and have a handy solution on how to pass a column name dynamically to the aggregate function?

Thanks for sharing your responses.

regards

Giri

pfefferf
Active Contributor
0 Kudos

What issues do you have? the $aggregate function receives an object to which you can add the column names which should be considered for the aggregation.

Maybe you can share your code or describe the error you get to become a better support.

former_member187794
Participant
0 Kudos

Thanks Sergio and Florian. I could resolve the issue, I have passed an object to the $aggregate function.

Thanks for your suggestions.

Regards

Giri

Accepted Solutions (0)

Answers (1)

Answers (1)

SergioG_TX
Active Contributor

Giri,

agree with Florian, in your $aggregate function, you can pass an object like

// table.$query().$where(oYourConditions).$aggregate(oYourColumns).$execute();

the variable/object oYourColumns would be like { COLNAME: true, COLNAME2: true }; // replace COLNAME/COLNAME2 with your actual column name from the table. You may have one or more of these columns in the object you are passing into the aggregation clause.

here is the API documentation - I hope this helps. Let us know if you run into other issues and good luck!

http://help.sap.com/hana/SAP_HANA_XS_DBUTILS_JavaScript_API_Reference_en/sap.hana.xs.libs.dbutils.xs...

my advise to make sure your code is running correctly would be to write a sql query on the sql console, then your xsds code to validate you did the correct XSDS syntax.