cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Cloud Application Programming (CAPM) virtual fields DB

1,480

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.

Accepted Solutions (1)

Accepted Solutions (1)

heiko_witteborg
Product and Topic Expert
Product and Topic Expert

Hi aakash.jain01 ,

I just merged the fix for this. It will be available with the next release.

Best regards,

Heiko

Answers (0)