1

I am trying to figure out how to determine if an item in my collection is visible in the grid after filtering? I'd like to update the following UpdateIf code for only those records showing:

UpdateIf( Nominations, true, { Status: {Value: "Approved"}, 'Approved By': varUser } );

It seems straightforward, but I simply can't find the answer. Thank you very much!

I've tried the following code without success:

Filter(MyCollection, Visible = true)

Chris2015
  • 1,030
  • 7
  • 28
  • 42

1 Answers1

0

You can use the same conditions you used for filtering collection instead of true in the UpdateIf function.

For example: Update all list items with ID greater than 5

Use formula like below:

UpdateIf(
   Nominations,
   ID > 5,
   {
       Status: { Value: "Approved" },
       'Approved By': varUser
   }
);

Similarly, you can add multiple conditions as per your requirements like:

UpdateIf(
   Nominations,
   ID > 5 && ID < 15,
   {
       Status: { Value: "Approved" },
       'Approved By': varUser
   }
);

OR you can use formula like below to update records which are available in the collection:

ForAll(
    MyCollection,
    Patch(
        Nominations,
        LookUp(Nominations, ID = ThisRecord.ID),
        {
            Status: { Value: "Approved" },
            'Approved By': varUser
        }
    )
)

Make sure you are passing values for all required columns in the list with correct data types.

Ganesh Sanap
  • 1,386
  • 1
  • 8
  • 18