on 2023 Aug 02 12:44 PM
Hello SAP CAP and Fiori Elements Experts,
I try to follow the Side Effect Annotations: Examples --> Additional Features in SAP Fiori Elements for OData V4 in my sample project. But the annotation:
@Common.SideEffects #effect: {
SourceProperties: [taxPercentage],
TargetProperties: [
ComputedTotalWithTax,
ComputedTax
]
}
Doesn't update the content of the Computed fields when I change the taxPercentage. I’ve tried also with a virtual field where I’ve added the calculation in the handler:
this.after("each", Orders, (order) => {
order.VirtualTotalWithTax =
order.total + (order.total * order.taxPercentage) / 100;
});
But this resulted in an endless loop when switching to the edit mode. There the Fiori Elements App requested endlessly the field VirtualTotalWithTax.
Does anyone had success creating an example where a calculated field is updated while being in draft?
Best Regards
Gregor
Request clarification before answering.
Hi,
I asked the same question some time ago. The answer was that drafts are not supported and should be handled with a separate implementation. However, it was said that in the future there might be a default handling for calculated fields from the database.
my Solution is this:
this.after('PATCH', 'Positions', async (data) => {
await UPDATE(Positions.drafts, data.ID).set`total = quantity * amount`
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
73 | |
30 | |
8 | |
8 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.