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

Patch Collection after Updates in Gallery

I have a gallery where I will be updating 2 text fields that I need to save back to the data source. I have created a collection (colCapacity) that grabs the records that will be updated

 

App On Start:

 

ClearCollect(

    colCapacity,

        Filter(

            AddColumns(

                'CAPACITY TRACKER',

                "_mainid",

                'CAPACITY TRACKER ID',

                "_month",

                'Capacity Date LookUp'.'Capacity Month Date',

                "_name",

                'Capacity Resource LookUp'.'Resource Name - Outlook',

                "_id",

                'Capacity Main LookUp'.'PR ID',

                "_projectname",

                'Capacity Main LookUp'.'Project Name',

            ),

            'Owning Manager Detail Tracker'.'Full Name' = User().FullName 

        )

    )

)

 

Gallery 1

I have 2 fields that will be updated, on each field I have the OnChange set to Select(Parent)

 

The Gallery 1 OnSelect property is set to:

Patch(

    colCapacity,

   ThisItem,

    {'Forecast Capacity': Value(forecastValue.Text)},

    {'Accrual Capacity ': Value(accrualValue.Text)}

)

 

When I make updates, I can see the items being updated correctly in the Collection.

 

Save Button

I have a ‘Save’ button, that when pressed, needs to submit all of the changes from the collection.

I have the OnSelect of the save button set to:

 

Patch('CAPACITY TRACKER',colCapacity)

 

But get the error, invalid argument type (Table) expected record value instead

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @todaytoo ,

The first issue I see is that your Collect code (the bottom item) will not work as the added columns do not exist in the data source. One way to fix is the "long" way (assuming you are creating new records here)

ForAll(
   colCapacity As aPatch,
   Patch(
      'CAPACITY TRACKER',
      {
         FieldName1: aPatch.FieldName1,
         FieldName2: aPatch.FieldName2,
         . . . . . .
      }
   )
)

 

Please click Accept as solution 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 Thumbs Up.

Visit my blog Practical Power Apps

 

View solution in original post

1 REPLY 1
WarrenBelz
Super User
Super User

Hi @todaytoo ,

The first issue I see is that your Collect code (the bottom item) will not work as the added columns do not exist in the data source. One way to fix is the "long" way (assuming you are creating new records here)

ForAll(
   colCapacity As aPatch,
   Patch(
      'CAPACITY TRACKER',
      {
         FieldName1: aPatch.FieldName1,
         FieldName2: aPatch.FieldName2,
         . . . . . .
      }
   )
)

 

Please click Accept as solution 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 Thumbs Up.

Visit my blog Practical Power Apps

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,192)