web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Problem with collectio...
Power Apps
Answered

Problem with collection - Shopping Cart

(0) ShareShare
ReportReport
Posted on by 25

Hi,

I have a problem with a collection. I have built something like a store for employee shopping. The products are collected in a collection. The collection with a button is sent to the list on SP.

1) How to give the same ID for the whole single collection ?
After submission, all products from the shopping cart are in separate rows. I need them to have one PO number.2023-10-24_12-38.png2023-10-24_12-40.png

Categories:
I have the same question (0)
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @mat4 ,

     

    It relies on how you update the collection to the list. Is PO Number a column in this list? What's the column type?

     

    Generally speaking, before updating, you can use below formula to bulk update the collection and add a PO number in it:

    UpdateIf(collection, true, {'PO number': ...})

    But where do you get or generate the PO number of all items?

     

    Best regards,

  • mat4 Profile Picture
    25 on at

    Hi @v-jefferni

    Yes, PO is one of columns in sharepoint list. 
     

    In general, this does not have to be solved by adding the same ID to all items in the collection.

    The question is whether it is possible to get a single PO number (for the whole collection) that is sent to the List as multiple rows.

    The next order that arrives (also multiple items) should have a different PO (for the whole collection one)

     

    Regards,

     
     
     
     
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @mat4 ,

     

    So, you need to generate the PO number automatically when submitting the collection, right? But what is the pattern of PO number generation? You can either create it anywhere in your App and save it in a variable, use it in Patch or use a set of static texts directly in Patch function for the PO number columns.

     

    Best regards,

  • mat4 Profile Picture
    25 on at

    Hi @v-jefferni,

     

    The pattern of PO is combination of standard ID number + phrase"/WESS" e.g.  11/WESS. 

     

    Best Regards,

    Matthew

     
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @mat4 ,

     

    Then where does the standard ID number come from? Can you have the PO number before submitting the collection?

     

    Best regards,

  • mat4 Profile Picture
    25 on at

    @v-jefferni 

    I do not have any ID for the PO. I tried adding a value of "1" to a column in the collection but there was no increment of this value in subsequent records.

     

    Regards,

    Matt

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @mat4 ,

     

    OK, then you can generate the number automatically using below formula, and use it when submitting the collection:

    Set(varPO, Concat(Add(First(Split(Last(SPlist).'PO Number'),"/"),1),"/WESS"));
    Patch(SPlist, ForAll(collection, {'PO Number': varPO, Quantity: ThisRecord.Quantity}))

     

    The variable is getting the PO Number from the last item of your list, split the value with / to get the number, add 1 to it and concatenate with "/WESS" to generate the new PO Number. Then this variable is used in the Patch function to update the value to list.

     

    Best regards,

  • mat4 Profile Picture
    25 on at

    Dear @v-jefferni 

     

    Function "Add" is not recognized 

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @mat4 ,

     

    Sorry, my fault. Try below:

    Set(varPO, Concat(Text(First(Split(Last(SPlist).'PO Number',"/")).Value+1),"/WESS"));
    Patch(SPlist, ForAll(collection, {'PO Number': varPO, Quantity: ThisRecord.Quantity}))

     

    BR,

  • mat4 Profile Picture
    25 on at

    Dear @v-jefferni , 

     

    I'm trying but i have some errors: 

    Set(varPO;Concat(Text(First(Split(Last('Zakupy pracownicze - zamówienia').'Numer zamówienia';"/"));Value+1);"/WESS"));

    mat4_0-1698316348998.png

     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

#2
11manish Profile Picture

11manish 224

#3
Valantis Profile Picture

Valantis 181

Last 30 days Overall leaderboard