on ‎2021 Aug 13 7:51 AM
Hello Everyone,
This question has backstory from here: CAP Virtual Fields
If a field of an entity is flagged as virtual in the cds model, no field is created on the corresponding database table. All good till here. If this entity is now called from with a filter on a virtual field with a GET request, we get the result without the filter applied to the virtual field. 'routingTarget' is virtual field in below example.
GET http://localhost:4004/v2/odata/ResponseTransaction?$filter=routingTarget eq ''
The above request results with all results without filters being applied on virtual fields in the where clause.
Now if i try to GET the same entity from an association like:
http://localhost:4004/v2/odata/RequestHeader('3')/messageResponse/messageResponseTransaction?$filter=routingTarget eq ''
'messageResponseTransaction' is the same entity ResponseTransaction accessed via association. I get the below error:
"SQLITE_ERROR: no such column: T2.routingTarget in: \nSELECT createdAt, createdBy, modifiedAt, modifiedBy, requestID_requestID_requestID, transactionID_requestID_requestID, transactionID_transactionID, transactionProcessed, determinationSource, routingAction, forwardMPID_mpID, copyMPID, overrideMPID_mpID, comments, messageID, messageText, messageType FROM CatalogService_ResponseTransaction T2 WHERE ( EXISTS ( SELECT 1 FROM CatalogService_ResponseHeader T1 WHERE ( EXISTS ( SELECT 1 FROM CatalogService_RequestHeader T0 WHERE ( T0.requestID = ? ) AND ( ( T0.requestID = T1.requestID_requestID ) ) ) ) AND ( ( T1.requestID_requestID = T2.requestID_requestID_requestID ) ) ) ) AND ( T2.routingTarget = ? ) ORDER BY requestID_requestID_requestID COLLATE NOCASE ASC, transactionID_requestID_requestID COLLATE NOCASE ASC, transactionID_transactionID COLLATE NOCASE ASC LIMIT 1000"
Here T2.routingTarget is being used in the WHERE clause while selecting the data even though it is a virtual field.
Thanks.
Request clarification before answering.
Hi aakash.jain01 ,
I just merged the fix for this. It will be available with the next release.
Best regards,
Heiko
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.