on 2023 Feb 04 7:31 AM
Hi Experts
I need to programmatically call an external parameterized service in my cap application.
External service url:
/servicename/ABC(Key=‘123’)/Set
CAP service.cds file:
entity Abc(Key:String(3)) as projection on ext.ABC;
CAP Node.js call: srv.run(SELECT.from(‘Abc(Key:’123’)’)); // tried passing in single quotes and template string both
This created a url like: dest.servicename/?$select=Key
Note: The external service is made out of calc view with parameters
Kindly help. david.kunz2 gregorwolf
Thanks
Kanika
Request clarification before answering.
Hi david.kunz2
Thanks for the reply!!
Well, I wrote 'key' hypothetically to avoid using exact names as my service.
Passing with and without quotes around the value also, didnt work.
Finally, I found the cqn way of passing which is finally making the correct URL '/ABC(Key=‘123’)/Set'.
Would be happy to try any other way of achieving the same 🙂
SELECT: { from: { ref: [{ id: "Abc", where: [{ ref: ["key"] }, "=", { val: `${value}` }] }, "Set"] }, columns: [ { ref: ["*"] } ], where: [{ ref: ["fieldname"] }, "=", { val: `${value}` }], } };
SELECT: {
from: { ref: [{ id: "Abc", where: [{ ref: ["key"] }, "=", { val: `${value}` }] }, "Set"] },
columns: [ { ref: ["*"] } ],
where: [{ ref: ["fieldname"] }, "=", { val: `${value}` }],
}
};
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi kanikamalhotra,
Iam also working on same requirement now. can you please share me code snippet once.
Thanks in Advance,
Sairam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi kanikamalhotra ,
"Key" is a reserved keyword, so it must be escaped and you don't need quotes around the value.
SELECT.from('Abc(![Key]:123)')
Best regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
22 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.