Hi all
I have a collection, allowing user to update all data then save all.
I use a ForAll to add or update all. However, the update only updates the first record with data from the last record.
Seems like ThisRecord.id is from first and .name is from last.
What is wrong here?
I nailed it.
ThisRecord refers to the item it is in, so ThisRecord within the LookUp is is for the present record within the LookUp. Therefore id=ThisRecord.id is always true.
The solution comes with the keyword As
Can you say what you changed?
hey @SonnichJensen
can u try this:
ForAll(palletList,
If(IsBlank(ThisRecord.id),
Notify(Concatenate("Pallet add: ", ThisRecord.item), NotificationType.Success, 500);
Patch(outbound_pallets, Defaults(outbound_pallets),
{
pallet_id: ThisRecord.pallet_id,
item: ThisRecord.item,
quantity: ThisRecord.quantity,
comment: ThisRecord.comment,
trip_id: tripList.Selected.id
}),
Notify(Concatenate("Pallet update: ", ThisRecord.id, " Item: ", ThisRecord.item, " Qty: ", ThisRecord.quantity), NotificationType.Information, 500);
Patch(outbound_pallets, LookUp(outbound_pallets, id = ThisRecord.id),
{
pallet_id: ThisRecord.pallet_id,
item: ThisRecord.item,
quantity: ThisRecord.quantity,
comment: ThisRecord.comment,
trip_id: tripList.Selected.id
});
)
);
Let me know if my answer helped solving your issue.
If it did please accept as solution and give it a thumbs up so we can help others in the community.
Greetings
WarrenBelz
637
Most Valuable Professional
stampcoin
570
Super User 2025 Season 2
Power Apps 1919
473