cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
neill_long
Responsive Resident
Responsive Resident

Patch

I am trying to use the patch function but something isn't right.

 

I have a SP list: NewTest

 

SPList.PNG

On my app i have a button 'Upload' which has the following the the OnSelect option:

 

ForAll(
   Gallery2.AllItems,
   Patch(
      'NewTest',
       Defaults('NewTest'),
       {
        Title:"Test",   
        Date_x0020_of_x0020_Request:TextInput4.Text,
        StaffName:TextInput3.Text,
        Quantity:TextInput7.Text,
        Item:TextInput1.Text,
        ...
        }
    )
)

But it is still showing as an error on the button:

 

 

app.PNG

On the 'New Order' button, i have the following on the OnSelect:

 

Collect(OrderCount,CountRows(OrderCount)+1)

 

Can anyone help and advise where i may i gone wrong?

 

thanks

Alistair

1 ACCEPTED SOLUTION

Accepted Solutions
v-micsh-msft
Community Support
Community Support

Hi @neill_long,

 

I think the issue here hsould be the recor mapping within the patch () function.

ForAll(
   Gallery2.AllItems,
   Patch(
      'NewTest',
       Defaults('NewTest'),
       {
        Title:"Test",   
        Date_x0020_of_x0020_Request:TextInput4.Text,
        StaffName:TextInput3.Text,
        Quantity:TextInput7.Text,
        Item:TextInput1.Text,
        ...
        }
    )
)

The TextInput.Text will not loop with each record within the Gallery, if here you would like to generate every record for the "NetTest" from the Gallery, then the field need to map with the original field name which is configrued within the TextINput text property.

 

Please take a try to collect the Gallery items into a collection, then use the forall with the collection.

 

For how to work with Patch, see:

Patch in PowerApps

 

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-micsh-msft
Community Support
Community Support

Hi @neill_long,

 

I think the issue here hsould be the recor mapping within the patch () function.

ForAll(
   Gallery2.AllItems,
   Patch(
      'NewTest',
       Defaults('NewTest'),
       {
        Title:"Test",   
        Date_x0020_of_x0020_Request:TextInput4.Text,
        StaffName:TextInput3.Text,
        Quantity:TextInput7.Text,
        Item:TextInput1.Text,
        ...
        }
    )
)

The TextInput.Text will not loop with each record within the Gallery, if here you would like to generate every record for the "NetTest" from the Gallery, then the field need to map with the original field name which is configrued within the TextINput text property.

 

Please take a try to collect the Gallery items into a collection, then use the forall with the collection.

 

For how to work with Patch, see:

Patch in PowerApps

 

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-micsh-msft

 

I'm still confused sorry.  I have a collection, called OrderCount, which when i click the new order a new line is added.  How would i use the forall with the collection?

 

I have asked about this in the past and was following the steps outlined, which didn't work for me but from the example was working for the person who responded to my initial query:

 

https://powerusers.microsoft.com/t5/General-Discussion/Order-form-to-be-able-to-order-multiple-items...

 

thanks

Alistair

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,858)