I have a collection called 'colYearGroup' which contains about 10 rows. In the collection, there is a column called 'Paper' and a column called 'Test', and an empty column called 'Marks'.
I need to loop through the collection and update the 'Marks' column by looking up a value from another collection called 'colTestLookup' - which holds the number of marks for any test and paper combination.
So I basically need to loop through the collection, and update one column of the record.
ForAll(
colYearGroup As data,
If(
And(YGSelectSubject.Selected.Value = "Maths", YGSelectAspect.Selected.Value="Number"),
Patch(
colYearGroup,
LookUp(colYearGroup,And(Paper=data.Paper,Test=data.Test)),
{
Marks: Text(LookUp(colTestLookup,And(Test=data.Test,Paper=data.Paper),Marks))
}
)
);
);
However, using this code, where I try to loop through the collection, and patch the current record, I get the error:
'This function cannot be used on the same data source that is used in ForAll'. Which is telling me I can't patch the record I'm on.
How can I Ioop through a collection and update each record in the loop?

Report
All responses (
Answers (