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

Patching Multiple Records to SharePoint

Hi Guys,

 

Please can you help I am creating an offline app that all the data saves to a collection until they do the last entry on a Saturday (for reference its a daily inspection).

When I use the patch on it, it works correctly and sends the data to SharePoint but it only puts the last items values ie. Saturdays values in all the entries.

 

Please can you help

 

ForAll(
OfflineData,
Patch(
'Quarry Daily Inspections',
Defaults('Quarry Daily Inspections'),
{
Title: Dropdown2.Selected.Value,
Activeface: Checkbox1.Value,
Facesadjacent: Checkbox1_1.Value,
Slopesadjacent: Checkbox1_2.Value,
Overburden: Checkbox1_3.Value,
Settlementlagoons: Checkbox1_4.Value,
Stockpiles: Checkbox1_5.Value,
Haulroads: Checkbox1_6.Value,
Signnotices: Checkbox1_7.Value,
Sitepersonnel: Checkbox1_8.Value,
Bundwaste: Checkbox1_9.Value,
Comments: TextInput1.Text
}
)

);
Clear(OfflineData);
SaveData(
OfflineData,
"OfflineData"
);
Navigate(Save)

1 ACCEPTED SOLUTION

Accepted Solutions
BCLS776
Super User
Super User

SharePoint probably won't let you convert single line of text columns to a yes/no or choice type, so there isn't an easy fix. This also gets well beyond your initial question, so it should go into another thread altogether. A few pointers though to get you started:

  • Whatever you are trying to Patch() must match the schema of the column, or it will throw an error
  • Some of your issues may come from a collection that is storing the boolean literal, true, as a string, "true" - make sure the collection is storing what you intend
  • Watch out for the Title column - it can only be a single line of text and nothing else

One of our other Super Users has a blog article on SharePoint yes/no columns. Worth a read.

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

3 REPLIES 3
BCLS776
Super User
Super User

Assuming your OfflineData collection has the same schema as your SharePoint List, try:

ForAll(
    OfflineData As aRecord,
    Patch(
        'Quarry Daily Inspections',
        Defaults('Quarry Daily Inspections'),
    {
        Title: aRecord.Title,
        Activeface: aRecord.Activeface,
        Facesadjacent: aRecord.Facesadjacent,
        Slopesadjacent: aRecord.Slopesadjacent,
        Overburden: aRecord.Overburden,
        Settlementlagoons: aRecord.Settlementlagoons,
        Stockpiles: aRecord.Stockpiles,
        Haulroads: aRecord.Haulroads,
        Signnotices: aRecord.Signnotices,
        Sitepersonnel: aRecord.Sitepersonnel,
        Bundwaste: aRecord.Bundwaste,
        Comments: aRecord.Comments
    }
    )
);

Hope that helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Hi Bryan,

 

Thank you for the quick reply, what would be the case as currently I have drop downs and check boxes for PowerApps but when doing it to SharePoint it kept throwing up an error until I changed the SharePoint list columns to single line of text.

 

Is there an easy way to fix this or do I need to re-create my columns 

.

 

Thank you in advance

 

Adam

BCLS776
Super User
Super User

SharePoint probably won't let you convert single line of text columns to a yes/no or choice type, so there isn't an easy fix. This also gets well beyond your initial question, so it should go into another thread altogether. A few pointers though to get you started:

  • Whatever you are trying to Patch() must match the schema of the column, or it will throw an error
  • Some of your issues may come from a collection that is storing the boolean literal, true, as a string, "true" - make sure the collection is storing what you intend
  • Watch out for the Title column - it can only be a single line of text and nothing else

One of our other Super Users has a blog article on SharePoint yes/no columns. Worth a read.

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

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 (3,368)