web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / add date to SPL when b...
Power Apps
Answered

add date to SPL when button is pressed

(0) ShareShare
ReportReport
Posted on by 9

Hi

 

I have a Power App where I'd like to write a date back to a SPL when a button is pressed.

 

Screenshot 2023-03-20 at 21.35.58.png

 

So you choose a date, press "start session" and it'll write that date back to a column named "Date" on my SPL.

 

Any help greatly appreciated.

 

Thanks

Categories:
I have the same question (0)
  • zuurg Profile Picture
    546 Super User 2024 Season 1 on at

    In the button's OnSelect you want to tell it to patch your record.  The 2nd argument for patch will be how you locate the recordm such as LookUp(SPLname, ID=Gallery1.Selected.Id) or something along those lines:

    Patch(SPLname,LookUp(SPLname,ID=Gallery1.Selected.ID),{Date: DatePicker1.SelectedDate})

  • ghostdragon Profile Picture
    9 on at

    What does ID=Gallery1 refer to?

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @ghostdragon,

    I think @zuurg wants to confirm with you that if you want to update an existing record or create a new record when you press a button.

     

    If you just want to create a new record to your list, you just need to:

    Patch(List,Defaults(List),{Date:DatePicker1.SelectedDate})

    Note that I assume that you Date column is a Date only column type, if it is single-line-of-text, you need to format the selected date into text string as beklow:

    Patch(List,Defaults(List),{Date:Text(DatePicker1.SelectedDate,"dd/mm/yyyy")})​
  • ghostdragon Profile Picture
    9 on at

    Hi @v-qiaqi-msft 

     

    Ah I thought I had it but I now get an error which says 'Network error when using Patch function: Field 'Title' is required.'

     

    OnSelect on button is Patch(Pool,Defaults(Pool),{Date:DatePicker1.SelectedDate})

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @ghostdragon,

    That's easy, you just need to put your Title field because SharePoint recgonize it as the Required by default.

     

    If you don't want it to be a required column, go to the list settings and change it into not required.

    vqiaqimsft_0-1679391534264.png

    Remember to refresh the data source when you re-try the formula.

     

  • ghostdragon Profile Picture
    9 on at

    Got it. 

     

    Patch(Pool, Defaults(Pool), {Title: "New Session", Date: DatePicker1.SelectedDate})

     

    Thanks for your help both

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#2
11manish Profile Picture

11manish 205 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard