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

Patch Multiple Field from PowerApps into SharePoint List

Hello Expert,

 

I am having trouble with my PowerApps as below:

 

My List is as below: 

Capture.PNGCapture2.PNGCapture3.PNG

 

My PowerApps main page should looks like the first powerapps screenshot, and when employee select a date of a Sunday, the date for the rest of the week is automatically generated.

 

Upon clicking the "Submit" Button, i need to patch the data into my List into 7 different line items.

 

The List needs to appear like this:

Created ByOperation TypeApproverLoc Time ZoneDateHoursActivity
Joe123AdamCentral Time Zone29-Sep-191Office
Joe123AdamCentral Time Zone30-Sep-192Vacation
Joe123AdamCentral Time Zone1-Oct-193Training
Joe123AdamCentral Time Zone2-Oct-194Travel
Joe123AdamCentral Time Zone3-Oct-195Office
Joe123AdamCentral Time Zone4-Oct-196Training
Joe123AdamCentral Time Zone5-Oct-197Vacation

 

I believe that the Date, Activity & Hours need to be patched. I have trouble creating the patch formula.

 

(If(IsBlank(DataCardValue8.Selected.Value)|| IsBlank(DataCardValue9.Selected.Claims)|| IsBlank(DataCardValue10.Selected.Value)|| IsBlank(DataCardValue11.SelectedDate)|| IsBlank(DataCardValue13.Text)|| IsBlank(DataCardValue12.Selected.Value)|| IsBlank(DataCardValue13_1.Text)|| IsBlank(DataCardValue12_1.Selected.Value)|| IsBlank(DataCardValue13_2.Text)|| IsBlank(DataCardValue12_2.Selected.Value)|| IsBlank(DataCardValue13_3.Text)|| IsBlank(DataCardValue12_3.Selected.Value)|| IsBlank(DataCardValue13_4.Text)|| IsBlank(DataCardValue12_4.Selected.Value)|| IsBlank(DataCardValue13_5.Text)|| IsBlank(DataCardValue12_5.Selected.Value)|| IsBlank(DataCardValue13_6.Text)|| IsBlank(DataCardValue12_6.Selected.Value),
UpdateContext({showError:true}), ...... (This portion of the syntax was made to show an error if items are left blank)

Patch('Contractor''s Main List',
Defaults('Contractor''s Main List'),
{
Date:DataCardValue11.SelectedDate,
Hours:DataCardValue13.Text,

Activity:DataCardValue12.Selected.Value,
}
);
Patch('Contractor''s Main List',
Defaults('Contractor''s Main List'),
{
Date:DataCardValue5.SelectedDate,
Hours:DataCardValue13_1.Text,

Activity:DataCardValue12_1.Selected.Value,
}
) ............... (This portion of the syntax was created to patch from PowerApps to List. I only made a loop for Sunday and Monday only as i have encountered unsolved errors, it should be looping until Saturday)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Patch Multiple Field from PowerApps into SharePoint List

Patch(
    SPListName, Defaults(SPListName),
    {
        column1: text,
        column2: text,
         .....
     }
)

View solution in original post

3 REPLIES 3
Highlighted
Frequent Visitor

Re: Patch Multiple Field from PowerApps into SharePoint List

If you need to create 7 lines, i.e. 7 new items in SP, then you have to apply the Patch formula accordingly 7 times.

So to this either save all necessary data into a collection first and use a ForAll loop or create 7 patch statements with the fields needed. 

Highlighted
Frequent Visitor

Re: Patch Multiple Field from PowerApps into SharePoint List

Can you show the example of the patch formula? 

 

I am very new with this and trying to figure this out with zero programming knowledge. :'(

 

Thank you in advance.

 

Siti

Highlighted
Frequent Visitor

Re: Patch Multiple Field from PowerApps into SharePoint List

Patch(
    SPListName, Defaults(SPListName),
    {
        column1: text,
        column2: text,
         .....
     }
)

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,892)