Hi all,
I am going round in circles on this and have tried multiple things to resolve it (patch the same collection, patch a different collection, RenameColumns, ThisRecord, ThisItem, tried a version of this:
JOIN One Columns From Another Collection - Matthew Devaney, etc). At the point now where I'm hoping someone from the community can help.
I have a collection, col1, which populates a gallery gal1.
Some Items in the Gallery will have a DropDown control drp1 (this is dependant on an attribute stored in col1). The Dropdown contains two values, 1 and 2.
OnSelect of a button outside of the Gallery, I want each item in the Gallery to be checked, and when the Dropdown control is applicable to an item, I want to patch the value of 1 or 2 (as selected in the Dropdown) to a column in the collection, OptValue.
I think that it is not possible to patch the collection that supplies the Gallery directly (col1) (fairly sure nothing happens when that is attempted) so I have set up col1a in the Patch arguments. col1a is a copy of col1, but with the target column OptValue with a value of 0 for each item.
No matter what I try to do, the values are being patched correctly but only to the first record in the collection. I can't seem to LookUp the correct record in the collection despite that record having a unique identifier, OPID.
Can anyone assist with this?
Here is the code as it stands:
If(
'drp1'.Selected.ID = 1,
// true branch
Patch(col1a, LookUp(col1a, OPID = ThisRecord.OPID),
{OptValue: 1}),
// false branch
Patch(col1a, LookUp(col1a, OPID = ThisRecord.OPID),
{OptValue: 2}
)
);
Looking at it now, I don't think I need the If statement as the Value of the Dropdown is all that needs to be patched. But the same problem will still exist - it refuses to LookUp the correct record in the Collection, using the OPID (value; unique), and the value just goes in to the first record in the collection.
Thanks all for the help.