I'm trying to save a bunch of updates to a (CDS) datasource all at once. To achieve this, I used the following construction:
// 'updates' is a local collection
ForAll( updates,
Patch( Elements, LookUp( Elements, ElementId=updates[@ElementId] ),
{
// some field updates
});
);
However, the red part is giving me a delegation warning.
Now I can see where this is coming from: the indexing in the local 'updates' collection is not supported by the LookUp delegation (at least I think that's the cause). However, this is an operation that should not be delegated in the first place: I want it to be performed before going to the data source so it's a simple 'lookup by ID'. But I can't pre-set it in a local variable because the operation takes place within a ForAll.
How can I work around this? Or should I use a different setup alltogether?
(detail: the 'updates' collection is not a 1:1 copy of the 'Elements' data type, but it does contain the ElementId guid)