
Announcements
Hello,
There is an Instruments table and there is an Many-to-Many relationship Categories. When editing the Instrument form, Relate() works as expected.
Set(
varInstrumentRecord,
LookUp(Instruments, Id=varInstrumentFormItem.Id)
);
ForAll(
CategoriesValue.SelectedItems,
Relate(varInstrumentRecord.Categories , ThisRecord)
);
But if I want to Unrelate() all old records before creating new ones, I get an error: This function cannot operate on same data source that is used in ForAll.
ForAll(
varInstrumentFormItem.Categories As LoopItem,
Unrelate(varInstrumentRecord.Categories, LoopItem)
);
How to Unrelate() all records at once?
P.S. If I urelate one record
Unrelate(varInstrumentRecord.Categories, First(varInstrumentFormItem.Categories))everything goes well.
Hi @Anonymous ,
Please try the showColumns() function in the first parameter of forall function.
Something like this:
ForAll(
ShowColumns(varInstrumentFormItem.Categories,"<GUID Field>") As LoopItem,
Unrelate(varInstrumentRecord.Categories, LookUp(Second table,GUID Field= LoopItem.GUID Field))
);
Best Regards,
Wearsky