cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Arne_R
Helper II
Helper II

Update Collection to Sharepoint

Hello I have a collection with records in it. Is it possible to patch each record to a Sharepoint list?

I now select a number of items, writing how many items I take of each type. When I'm done taking items, I'd like to update the quantity in the Sharepoint list.

 

An alternative is to change the quantity after each selection of an item. I'd rather not do this because I have an overview where you can "cancel" the items taken, forcing the number to be updated again.

 

Is it possible with a "ForAll"?

 

Sample data of the collection: 

AantalArtikelProjectnummer... (+ other columns)
3Artikel_A12345

 

2Artikel_B67890

 

5Artikel_A67890

 

 

Sharepoint sample data: 

TotaalArtikelDescription... (+ other columns)
20Artikel_ADescription A

 

15Artikel_BDescription B

 

17Artikel_CDescription C

 

 

What I want in Sharepoint: 

TotaalArtikelDescription... (+ other columns)
12 (20-5-3)Artikel_ADescription A

 

13 (15-2)Artikel_BDescription B

 

17Artikel_CDescription C

 

 

 

EDIT: The column Aantal is 'GroupBy'

 

Thanks in Advance! 

Arne

8 REPLIES 8
RandyHayes
Super User
Super User

@Arne_R 

As long as your column names are the same and the records match in your collection, then you can utilize the following formula:

  Patch(yourDataSource, yourCollection)

 

If this is ultimately coming from a gallery, then you don't need a collection at all, you can use the Gallery as your collection.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes, thanks for your reply. 

 

I do use a gallery.
For example where I generate the following:
- 1x Item_A for Project_1
- 3x Item_B for Project_2
- 2x Item_A for Project_2
- 1x Item_A for Project_1
- 1x Item_C for Project_1
- Delte 1x Item_C for Project_1

 

If I confirm that the selection is correct via a button, I create a collection in which I generate the following:
- 2x Item_A for Project_1
- 3x Item_B for Project_2
- 2x Item_A for Project_2


(So ​​I group the data, this list is converted to a csv, which is processed by our internal programs). However, now I also want to update the data in SharePoint.So I only want to perform the patch when I know that no more items will be changed.

 

Can I patch the collection? Because there are some records "the same". Not all the columns match.

 

Thanks for your comment!

RandyHayes
Super User
Super User

@Arne_R 

Yes, you can perform what you need all from the Gallery items.  You could also have in a collection if needed, but it is a duplicate then of your data in the app.  

 

Ultimately, your columns for your list need to be accurate.

 

Would it be possible to share a screenshot of the gallery you have to put what you are stating in context for me?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

First I take items from the selection screen. 
Next, I can see (and delete) the items in the detailscreen. 

I have these columns in the Gallery

Artikelcode
Omschrijving
Aantal
Project
Subproject

 

But I have a lot more columns in SharePoint. 
The only important columns to update the sharepoint list are: 'Aantal' and 'Artikelcode'.

Screenshots attached.

 

Thanks for your time!

RandyHayes
Super User
Super User

@Arne_R 

Okay, so your "selection screen" is not so much a Gallery of items as it is just a single item and you have a Save Receipt (bon opslaan) button to add it to a collection.

 

So at the end of it all, you will need to take your collection and patch the items in it to your list.  One very important item you will need is the primary key...the ID of the record.  Without that, you will suffer performance by looking them up again, or you will end up with new records rather than updates.

 

So, in general, your final submit formula for the collection will be like this:

Patch(
   yourList,
   ShowColumns(yourCollection,
      "ID", "Artikelcode", "Omschrijving", "Aantal", "Project", "Subproject"
   )
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes Thank you for your time! Gonna check it as soon as possible. 

RandyHayes
Super User
Super User

@Arne_R 

Sounds good!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

 

Hi

 

It doesn't work. Got a table while expecting a record.

 

Same for: 

Patch(yourList;
    ForAll(Gallery.AllItems As _item;
        {ID: _item.ID;
         Aantal: Value(_item.Aantal)
        }
    )
);;

I found this in one of your posts (link)

 

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 (5,165)