diegomvh / angular-odata

Client side OData typescript library for Angular
https://www.npmjs.com/package/angular-odata
MIT License
50 stars 14 forks source link

`compute()` doesn't add any query params #91

Open hakimio opened 1 week ago

hakimio commented 1 week ago

query.compute() doesn't seem to do anything.

diegomvh commented 5 days ago

Hello @hakimio, You're right, I completely overlooked the render of compute. It's all set now, and I'll release it in the next version. Thank you for pointing out that absence :) Unfortunately, I don't have many APIs or any implementation to test compute. If you can, I would appreciate the feedback to know that it's correct.

Best regards

hakimio commented 5 days ago

Hi Diego,

thanks for taking a look at the issue. I am using SAP CAP nodejs backend. I thought it supported compute transformation, but, unfortunately, at least the nodejs implemention does not support it. So, I could just test if the generated query looks good. In general, it should look like any other $apply option:

/myOdataApi?$apply=compute(year(alertTime) as alertYear, month(alertTime) as alertMonth, day(alertTime) as alertDay)
/filter(alertDate gt 2019-01-01Z)
/groupby((alertYear, alertMonth, alertDay), aggregate($count as Count))