Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

Pat;ch with Multiple ForAll

(1) ShareShare
ReportReport
Posted on by 14
I have a Power Apps screen with a series on TextInputs and two galleries.

I am tryin to Patch the data to a SharePoint list.

I was able to do it with the Patch and one ForAll succuessfully. But once I added the second
ForAll I get an error.

What am I missing?

There error says "Title isn't recognized". When I delete Title the error moves to the next item (Job_Name).
Patch(Work_Order_List,
    ForAll(WO_Component_Gallery.AllItems,
    {
     Component: Dropdown1.Selected.Value,
     Component_Description: TextInput3.Text,
     Component_Notes: TextInput3_1.Text,
     Component_Quantity: Value(TextInput3_3.Text),
     Component_UoM: TextInput3_4.Text,
     Component_Unit_Price: Value(TextInput3_5.Text),
     Component_Extension: Value(TextInput3_6.Text)
    },
 
    ForAll(WO_Labor_and_Equipment_Gallery.AllItems,
    {
     Labor_and_Equipment: Dropdown1_1.Selected.Value,
     L_and_E_Description: TextInput3_7.Text,
     L_and_E_Notes: TextInput3_8.Text,
     L_And_E_Quantity: Value(TextInput3_10.Text),
     L_and_E_UoM: TextInput3_11.Text,
     L_and_E_Unit_Price: Value(TextInput3_12.Text),
     L_and_E_Extension: Value(TextInput3_13.Text),
    },
       
     Title: WO_Customer_CO_No_Fld.Text,
     Job_Name: WO_Job_Name_Fld.Text,
     Job_Number: WO_Job_Number_Fld.Text,
     Date_of_Service: WO_Date_of_Service_Fld.SelectedDate,
     Customer_Name: WO_Customer_1_Fld.Text,
     Point_of_Contact: WO_Point_of_Contract_Fld.Text,
     Phone: WO_Contact_Phone_Fld.Text,
     Email_Address: WO_Contact_Email_Fld.Text,
     Scope_of_Work: WO_Scope_of_Work_Fld.Text
    }
   
);
 
Notify("The work order data has been successfully submitted.",NotificationType.Success,5000)
  • WarrenBelz Profile Picture
    WarrenBelz 144,858 on at
    Pat;ch with Multiple ForAll
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • WarrenBelz Profile Picture
    WarrenBelz 144,858 on at
    Pat;ch with Multiple ForAll
    Coming in here to point out the fundamental issue - if (as I assume) you are trying patch all of that to one new record combining the two galleries and also the control values outside the gallery, you need to "line up" it all into records before you Patch. Assuming both galleries have the same number of records - it would be something like this (please note this is free-typed, so more to give you an idea of what has to be done). You need to
    • Grab the two galleries applying the correct field names (from the List).
    • Add a sequential identifying number so you can "line up" the records.
    • Combine the whole lot into one Table adding all the values from both galleries and also the "common" values.
    • Patch the resulting Table directly to the List. Providing all the field names exist in the List and are of the same type, it should work.
    With(
       {
          _Component:
          ForAll(
             WO_Component_Gallery.AllItems As _WOC,
             {
                Component: _WOC.Dropdown1.Selected.Value,
                Component_Description: _WOC.TextInput3.Text,
                Component_Notes: _WOC.TextInput3_1.Text,
                Component_Quantity: Value(_WOC.TextInput3_3.Text),
                Component_UoM: _WOC.TextInput3_4.Text,
                Component_Unit_Price: Value(_WOC.TextInput3_5.Text),
                Component_Extension: Value(_WOC.TextInput3_6.Text)
             }
          ),
          _Labor:
          ForAll(
             WO_Labor_and_Equipment_Gallery.AllItems As _WOL,
             {
                Labor_and_Equipment: _WOL.Dropdown1_1.Selected.Value,
                L_and_E_Description: _WOL.TextInput3_7.Text,
                L_and_E_Notes: _WOL.TextInput3_8.Text,
                L_And_E_Quantity: Value(_WOL.TextInput3_10.Text),
                L_and_E_UoM: _WOL.TextInput3_11.Text,
                L_and_E_Unit_Price: Value(_WOL.TextInput3_12.Text),
                L_and_E_Extension: Value(_WOL.TextInput3_13.Text),
             }
          )
       },
       With(
          {   
             _CompNo:
             ForAll(
                Sequence(CountRows(_Component)),
                Patch(
                   Index(
                      _Component,
                      Value
                   ),
                   {No1: Value}
                )
             ),
             _LaborNo:
             ForAll(
                Sequence(CountRows(_Labor)),
                Patch(
                   Index(
                      _Labor,
                      Value
                   ),
                   {No2: Value}
                )
             )
          },
          With(
             {
                _Combined:
                DropColumns(
                   AddColumns(
                      CompNo,
                      Labor_and_Equipment,
                      LookUp(
                         _LaborNo,
                         No2 = No1
                      ).Labor_and_Equipment,
                      L_and_E_Description,
                      LookUp(
                         _LaborNo,
                         No2 = No1
                      ).L_and_E_Description,
                      L_and_E_Notes,
                      LookUp(
                         _LaborNo,
                         No2 = No1
                      ).L_and_E_Notes,
                      L_And_E_Quantity,
                      LookUp(
                         _LaborNo,
                         No2 = No1
                      ).L_And_E_Quantity,
                      L_and_E_UoM,
                      LookUp(
                         _LaborNo,
                         No2 = No1
                      ).L_and_E_UoM,
                      L_and_E_Unit_Price,
                      LookUp(
                         _LaborNo,
                         No2 = No1
                      ).L_and_E_Unit_Price,
                      L_and_E_Extension,
                      LookUp(
                         _LaborNo,
                         No2 = No1
                      ).L_and_E_Extension,
                      Title,
                      WO_Customer_CO_No_Fld.Text,
                      Job_Name, 
                      WO_Job_Name_Fld.Text,
                      Job_Number, 
                      WO_Job_Number_Fld.Text,
                      Date_of_Service, 
                      WO_Date_of_Service_Fld.SelectedDate,
                      Customer_Name,
                      WO_Customer_1_Fld.Text,
                      Point_of_Contact,
                      WO_Point_of_Contract_Fld.Text,
                      Phone, 
                      WO_Contact_Phone_Fld.Text,
                      Email_Address, 
                      WO_Contact_Email_Fld.Text,
                      Scope_of_Work, 
                      WO_Scope_of_Work_Fld.Text
                   ),
                   No1
                )
             },
             Patch(
                Work_Order_List,
                _Combined
             )
          )
       )
    )

     
  • BD-01080338-0 Profile Picture
    BD-01080338-0 14 on at
    Pat;ch with Multiple ForAll
    Thanks for your reply.
     
    That did NOT work either.
  • Suggested answer
    mmbr1606 Profile Picture
    mmbr1606 10,320 on at
    Pat;ch with Multiple ForAll
    hey
     
    can u try this:
    ForAll(
        WO_Component_Gallery.AllItems,
        Patch(
            Work_Order_List,
            Defaults(Work_Order_List),
            {
                Component: Dropdown1.Selected.Value,
                Component_Description: TextInput3.Text,
                Component_Notes: TextInput3_1.Text,
                Component_Quantity: Value(TextInput3_3.Text),
                Component_UoM: TextInput3_4.Text,
                Component_Unit_Price: Value(TextInput3_5.Text),
                Component_Extension: Value(TextInput3_6.Text),
                Title: WO_Customer_CO_No_Fld.Text,
                Job_Name: WO_Job_Name_Fld.Text,
                Job_Number: WO_Job_Number_Fld.Text,
                Date_of_Service: WO_Date_of_Service_Fld.SelectedDate,
                Customer_Name: WO_Customer_1_Fld.Text,
                Point_of_Contact: WO_Point_of_Contract_Fld.Text,
                Phone: WO_Contact_Phone_Fld.Text,
                Email_Address: WO_Contact_Email_Fld.Text,
                Scope_of_Work: WO_Scope_of_Work_Fld.Text
            }
        )
    );
    
    ForAll(
        WO_Labor_and_Equipment_Gallery.AllItems,
        Patch(
            Work_Order_List,
            Defaults(Work_Order_List),
            {
                Labor_and_Equipment: Dropdown1_1.Selected.Value,
                L_and_E_Description: TextInput3_7.Text,
                L_and_E_Notes: TextInput3_8.Text,
                L_And_E_Quantity: Value(TextInput3_10.Text),
                L_and_E_UoM: TextInput3_11.Text,
                L_and_E_Unit_Price: Value(TextInput3_12.Text),
                L_and_E_Extension: Value(TextInput3_13.Text),
                Title: WO_Customer_CO_No_Fld.Text,
                Job_Name: WO_Job_Name_Fld.Text,
                Job_Number: WO_Job_Number_Fld.Text,
                Date_of_Service: WO_Date_of_Service_Fld.SelectedDate,
                Customer_Name: WO_Customer_1_Fld.Text,
                Point_of_Contact: WO_Point_of_Contract_Fld.Text,
                Phone: WO_Contact_Phone_Fld.Text,
                Email_Address: WO_Contact_Email_Fld.Text,
                Scope_of_Work: WO_Scope_of_Work_Fld.Text
            }
        )
    );
    
    Notify("The work order data has been successfully submitted.", NotificationType.Success, 5000);
    
    if it worked please mark as verified answer
     
     
    cheers

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

Kickstarter Events…

Register for Microsoft Kickstarter Events…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #13 Writing Effective Answers…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,858

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,505

Leaderboard