cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jbend088
Frequent Visitor

Update date column every time a gallery item is patched into another datasource

Hello Power Platform Community,

 

I have a gallery that uses SharePoint as a data source and its columns include several text input fields, a date field and a checkbox field. I also have a button to patch over the records that are selected by the checkbox column  in the gallery (using a collection 'colGrid'). I am trying to configure the date column so that if a selected record is patched, the date field will update to today's date for the selected records only (unselected records are not patched and hence I do not want the date for these items updated). 

 

Please let me know if this process is achievable; your response is greatly appreciated. 

 

Thanks,

 

Jackson

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@jbend088 

Ditch the collection and this will all be automatic!

Your OnSubmit formula on the button outside of your Gallery should be:

Patch(yourDataSource, 
    ForAll(Filter(yourGallery.AllItems, yourCheckbox.Value),
        {ID: ID,
         yourDateColumn: Now(),
         otherColumn: yourTextInput.Text
        }
    )
)

This will patch all selected records to your datasource and update the Date column to Now and any other column to any other value from the gallery or elsewhere.

 

As long as the gallery is based on the datasource and not some static collection, then the Gallery will reflect the changes immediately.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

1 REPLY 1
RandyHayes
Super User
Super User

@jbend088 

Ditch the collection and this will all be automatic!

Your OnSubmit formula on the button outside of your Gallery should be:

Patch(yourDataSource, 
    ForAll(Filter(yourGallery.AllItems, yourCheckbox.Value),
        {ID: ID,
         yourDateColumn: Now(),
         otherColumn: yourTextInput.Text
        }
    )
)

This will patch all selected records to your datasource and update the Date column to Now and any other column to any other value from the gallery or elsewhere.

 

As long as the gallery is based on the datasource and not some static collection, then the Gallery will reflect the changes immediately.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (3,779)