on 2024 Oct 11 5:46 AM
Hi,
I wrote a CAP service which is communicating with C4C via OData.
In the service I want to read all BusinessPartner with a certain ChangeDate.
The pure OData Call will be:
https://myXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/BusinessPartnerCollection?$filter=EntityLastChangedOn ge datetimeoffset'2024-01-10T06:35:38.1533450Z'
In my service I wrote:
const c4cBuPaService = await cds.connect.to("c4c_bupa");
const allBuPa = await c4cBuPaService.run(SELECT(["AccountID", "ContactID"]).from("ContactCollection").where(`ChangedOn > datetimeoffset'${myDate.toISOString()}'`.toString()));
....$filter=EntityLastChangedOn ge 'datetimeoffset'2024-01-10T06:35:38.1533450Z''
So, the datetimeoffset is enclosed in quotation marks.
I tried all various options to change it, no success.
So my question would be: How to query a timestamp in CDS?
Thanks
Jens
Request clarification before answering.
Hi @jensniemeyer ,
Have you tried the SQL-like fluent API mentioned in the documentation?
I'm thinking something like this:
SELECT(["AccountID", "ContactID"]).from("ContactCollection").where({ ChangedOn: { '>': myDate } })
Could you check if this could work?
Rgards,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
30 | |
10 | |
8 | |
8 | |
7 | |
7 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.