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

Error - collect expects a 'Record' type and using a 'Table' Type

I am currently trying to make an app that is capable of working offline by adding the data to a collection and then uploading it to SharePoint at the end.

 

My collect to get the data in to a collection appears to be working fine but when I try and get the data from the collection back up to SharePoint, I get an error on a field thats a choice (dropdown) that states: "Incompatible type. The 'Container Size' column in the data source you're updating expects a 'Record' type and you're using a 'Table' type.

The data col in SharePoint is choice.

The input in PowerApps is a dropdown.

 

Collect(
    OffLineData,
    {
        BatchID: DataCardValue9.Text,
        SiteName: BrandInput.Text,
        Brand: NameInput.Text,
        ContainerSize: DataCardValue7.SelectedItems,
        Product: DataCardValue1.SelectedItems,
        Unbroached_x002f_Broached:DataCardValue6.Selected.Value,
        BestBeforeDate: DataCardValue10.SelectedDate,
        DateOfDestruction: DataCardValue11.SelectedDate,
        Title: DataCardValue2.Text,	
        BUN: BUNInput.Text,
        GMName: NameInput.Text,
        TotalGallonsInBroachedContainers: DataCardValue8.Text
    }
)

 

Above is what I have entered for the collect which seems to work but when i try to upload to sharepoint using

 

Collect('Draught Beer Disposal',OffLineData)

 

I get the error above.


Any help would be a huge help!

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @markaxtell :

According to your description, the error seems to be caused by a mismatch in data type.

The value of DataCardValue7.SelectedItems is a table type date.But the wrong content is The "'Container Size' column in the data source you're updating expects a 'Record' type".

  • Could you tell me what ContainerSize's data type is?(ContainerSize fied in the SharePoint list)
  • Whether it can be replaced with other values?

Maybe you can try this code:

 

DataCardValue7.Selected

 

If the problem is not resolved, can you tell me more details?

 Best Regards,

 Bof

View solution in original post

5 REPLIES 5
KroonOfficeSol
Resident Rockstar
Resident Rockstar

A collection = a table 

One row in the collection = one record.

 

So you have to loop through the records in the collection using the ForAll formula.

 

Also, instead of collect() use Patch() when writing to Sharepoint.

 

Paul

So is the collection correct its just the way i need to upload it to SharePoint using ForAll and Patch?

I have now done this but i still get the same error

ForAll(OffLineData,Patch('Draught Beer Disposal',Defaults('Draught Beer Disposal'),{BatchID:BatchID,SiteName:SiteName,Brand:Brand,Product:Product,ContainerSize:ContainerSize,Unbroached_x002f_Broached:Unbroached_x002f_Broached,BestBeforeDate:BestBeforeDate,DateOfDestruction:DateOfDestruction,Title:Title,BUN:BUN,GMName:GMName,TotalGallonsInBroachedContainers:TotalGallonsInBroachedContainers}))

Hi @markaxtell :

According to your description, the error seems to be caused by a mismatch in data type.

The value of DataCardValue7.SelectedItems is a table type date.But the wrong content is The "'Container Size' column in the data source you're updating expects a 'Record' type".

  • Could you tell me what ContainerSize's data type is?(ContainerSize fied in the SharePoint list)
  • Whether it can be replaced with other values?

Maybe you can try this code:

 

DataCardValue7.Selected

 

If the problem is not resolved, can you tell me more details?

 Best Regards,

 Bof

View solution in original post

Thank you ever so much! I have managed to get it sorted!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,584)