on 07-09-2021 10:40 AM
Hi Experts,
I am working on a CAP project in which i have defined an entity in my data-model.cds file and exposed that enityt as Odata in the srv module.
data-model.cds
namespace my.leads;
using { managed } from '@sap/cds/common';
entity LeadDetails : managed{
key leadID:String(24);
leadStatus : String(24);
leadType :String(24);
partnerInCharge : String(30);
projectID : String(16);
Region : String(10);
Unit : String(10);
fee : Integer;
expenses : Integer;
contingentFee : Integer;
contingentExpense : Integer;
clientID : String(10);
clientName : String(50);
contractValue : Integer;
}
cat-service.cds
using my.leads as my from '../db/data-model';
@path : 'lead'
service CatalogService {
entity LeadDetails @readonly as projection on my.LeadDetails;
}
When I run the oData and use the $select, I noticed that the key field defined in my entity is always returned in the output.
In the screenshot, you can see that even though I passed $select=Region,Unit but in the output I got leadID as well which is the key field.
Is it possible to not get the key field retuned when specific columns are requested using $select in CAP.
Please advise.
Regards,
Arjun
Hi Arjun,
thank you for the additional details. As mentioned by David you have you use the $apply parameter. Check out my examples at tests/analytics.http.
CU
Gregor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
11 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.