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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch the selected row...
Power Apps
Unanswered

Patch the selected row only in gallery

(0) ShareShare
ReportReport
Posted on by 237

 

Hi Community Team,

 

 I Created canvas for timesheet .Datasource is sharepoint list.

 

Created collectin for add a new row in gallery. 

My requirement is when user select save button that particular row only saved in sharepoint list.

Gallery contains-Date:Datepicker,Dropdown:Project,Dropdown:Task,Dropdown:Type,Hour:Text Input,Comment:Text input.

Note:Project and Task are lookup column in shareppoint list.

Below  Project Dropdown--Project

            TaskDropdown--Task

Kindly provide code for onselect of save button.

Powerappsuser11_0-1690892715276.png

 

Thanks in advance for quick response.....!!!

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

    Hi @Powerappsuser11,

     

    Try this formula :

    Patch(DateSource, ThisItem, 
    {Date : ThisItem.Date.SelectedDate,
    Project : ThisItem.Project.SelectedText.Value,
    Task : ThisItem.Task.SelectedText.Value,
    Type : ThisItem.Type.SelectedText.Value,
    Hour : ThisItem.Hour.Text,
    Comment : ThisItemComment.Text}
    )

     

    If Hour is a number type in your sharepoint list then the formula is Value(ThisItem.Hour.Text)

     

     

    Hope this will help you 🙂

  • akselmb Profile Picture
    65 on at

    Hi @Powerappsuser11 

     

    Try this on the OnSelect-property for the Save-button:

     

    Patch(
     SPDataSourceName,
     Defaults(SPDataSourceName),
     {
     Date: ThisItem.Date.SelectedDate,
     Project: LookUp(SPProjectsList, ProjectName = ThisItem.Project).ID,
     Task: LookUp(SPTasksList, TaskName = ThisItem.Task).ID,
     Type: ThisItem.Type.SelectedItem,
     Hour: Value(ThisItem.Hour.Text),
     Comment: ThisItem.Comment.Text
     }
     )

     

    Change SPDataSourceName with the name of your datasource. Same goes with SPProjectList and SPTaskList

     

    Let me know how it goes 🙂 

     

     

  • Powerappsuser11 Profile Picture
    237 on at

    Hi @Fardy1 ,

     

    Above code written but getting errors,

    Please help me.

    Patch('Time sheet',ThisItem,

    {
    Title:User().FullName,Email:User().Email,status:{Value:"Draft"},
    Description:TextInput7_1.Text,
    Hour:Value(TextInput7.Text),
    'Date and Time':DatePicker6.SelectedDate,
    'Extended Hour':Value(TextInput10.Text),
    Project:Dropdown10.SelectedText.Value,
    'Project Line':Dropdown11.SelectedText.Value,
    'Hours Type':Dropdown12.Selected,
    }))

    Powerappsuser11_0-1690894470766.png

     

     

  • akselmb Profile Picture
    65 on at

    Based on the error-message that you got, try this instead for your line related to project:

    Project: LookUp(SPProjectsList, ProjectName = ThisItem.Project.Value).ID
  • Powerappsuser11 Profile Picture
    237 on at

     

    Hi @akselmb 

     

    Thanks for quick respond.

    I applied save button in gallery control,user select a row that row only saved in sharepoint.

    below is my code but getting errors,plese help to resolve  this issues.

    Patch('Time sheet',ThisItem,

    {
    Title:User().FullName,Email:User().Email,status:{Value:"Draft"},
    Description:TextInput7_1.Text,
    Hour:Value(TextInput7.Text),
    'Date and Time':DatePicker6.SelectedDate,
    'Extended Hour':Value(TextInput10.Text),
    Project:LookUp('Time sheet',Project=ThisItem.Project.Value).ID,
    'Project Line':LookUp('Time sheet','Project Line' =ThisItem.Task.Value).ID,
    'Hours Type':Dropdown12.Selected,
    }))

    Powerappsuser11_0-1690895222896.png

     

  • Fardy_MADI_2 Profile Picture
    332 Super User 2024 Season 1 on at

    According to this error, it seems that your Project column in your sharepoint list is a number type.

  • Powerappsuser11 Profile Picture
    237 on at

     

    Hi @Fardy1 

     

    Those are in lookup columns only.

    Powerappsuser11_0-1690895726823.png

     

  • akselmb Profile Picture
    65 on at

    My bad, @Powerappsuser11 . Try removing ".ID" after the LookUp-function. The error message is saying that it is excepting a record and by adding ".ID" we are giving it the records ID instead of the whole record. Same goes for the similar lines.

    Project: LookUp(SPProjectsList, ProjectName = ThisItem.Project.Value)

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 740 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 342 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard