cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AuburnMist
Resolver I
Resolver I

Patch from Gallery - Invalid argument type (table). Expecting a record value instead

Hi folks, 

 

I have a gallery that is displaying employee production stats. The info is coming from a SharePoint list called SPStats. 

 

SPStats contains one row of data for each file an employee has completed, so I use the gallery to group columns and to sum up the total number of files completed by each employee. 

 

My gallery only has 4 columns:

1) Employee Name (lblName)

2) Total Processed (lblProcessed)

3) Week Start (lblWkStart)

4) Week End (lblWkEnd)

 

What I am trying to do is patch the following 4 items into a different SharePoint list called SPProduction. All items are single line of text, as are the column types I'm trying to patch them to. 

My code is throwing an error that it is expecting a record value instead of a table. I'm not sure how to successfully patch these items to my list. 

 

My current code is: 

Patch(SPProduction,ForAll(gal_Stats.AllItems,{EmployeeName:lblName.Text, wkStrt:lblWkStart.Text, wkEnd:lblWkEnd.Text,TotalProcessed:lblTotalProcessed.Text}))

 

Can someone help out? 

 

thank you 🙂 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @AuburnMist ,

Then you should need this

Patch(
   SPProduction,
   ForAll(
      gal_Stats.AllItems As aPatch,
      {
         EmployeeName: aPatch.lblName.Text, 
         wkStrt: DateValue(aPatch.lblWkStart.Text), 
         wkEnd: DateValue(aPatch.lblWkEnd.Text),
         TotalProcessed: aPatch.lblTotalProcessed.Text
      }
   )
)

 

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

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @AuburnMist ,

One of those columns in your list must be something else than a Single Line of Text - can you please check this as the error is stating this is the issue.

Oh my gosh.. you are correct. Initially I was going to use text columns for all, but ended up using actual date columns for the wkStrt and wkEnd! Doh! 

Hi @AuburnMist ,

Then you should need this

Patch(
   SPProduction,
   ForAll(
      gal_Stats.AllItems As aPatch,
      {
         EmployeeName: aPatch.lblName.Text, 
         wkStrt: DateValue(aPatch.lblWkStart.Text), 
         wkEnd: DateValue(aPatch.lblWkEnd.Text),
         TotalProcessed: aPatch.lblTotalProcessed.Text
      }
   )
)

 

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

Thank you so very much. It worked! I super appreciate it! 🙂 

AuburnMist
Resolver I
Resolver I

Is it possible, at the same time that I perform the above patch, to also patch another item, that is NOT inside of the gallery? I need to record the fiscal year also, but this is contained in a label outside of the gallery. the label is called lblFiscal_Stats and is a text type column. 

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 (4,832)