on 03-19-2021 9:03 AM
Hi everyone,
I am currently trying to use the OData.remove() function.
My Code looks like this:
Data Model:
entity Appointments {
key appointDate : Date;
key type : String(100);
key employees : Association to one Employees;
areas : Association to one Areas;
}
Code in the Controller:
const sPath = "/Appointments(appointDate='" + sDate + "',type='" + sCurrType + "',employees_idp_id='" + sIDP_ID + "', employees_email=" + sEmail + "')";
oAllUserModel.remove(sPath, {
success: function () { },
error: function (oError) {
MessageToast.show(oError.message);
}
});
The variable sDate is formatted like this:
2021-03-15T00:00:00.000Z
But when the call is made, it fails with the error:
No 'Edm.Date' value found for key 'appointDate'
Does anyone know a solution for this Problem?
Thanks in advance!
Lukas
Hi lukasmetzger,
In the essence, you already have the solution close to your eyes 😉 As your `appointDate` is of type `Date`, CAP (and OData) are expecting a value of 'YYYY-MM-DD' while you are sending 'YYYY-MM-DD`T`HH:MM:SS`Z`'. You can either strip of the time part using `substr(0, 10)` or change your CDS data type to `DateTime`.
Let me know if this helps!
Best,
Janik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
72 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.