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 / Add multiple items fro...
Power Apps
Answered

Add multiple items from SP list to collection

(0) ShareShare
ReportReport
Posted on by 188

I have a gallery where I add items to a shopping cart style collection. The code to add the item from the gallery to the collection is:

 

If(
 IsBlank(LookUp(colQuote, PID = ThisItem.ID)),

Collect(colQuote,
 {
PID:ThisItem.ID, 
Product:ThisItem.Title,
Price:Value(ThisItem.PriceExVAT),
HMCode:ThisItem.HMCode,
Category:ThisItem.Category,
ProductQuantity:1,
SubTotal: Value(ThisItem.PriceExVAT) * 1
}));



However, I also want to able to add multiple items to a collection with one click. So I've created buttons with a + icon to do this OnSelect.

 

Instead of hard coding it to the OnSelect, I want to store these items in a SPList "BoilerFittingsPack" and then depending on which of the three buttons is clicked (buttons would filter the Category) and add all items within that category to the collection. 

 

The BoilerFittingsPack schema would be similar as the code above with same column names.

How would I go about this to achieve it?

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    Hi @drossi90 ,

    I am not sure about how your buttons, but a checkbox would work like this

    If(
     IsBlank(LookUp(colQuote, PID = aCol.ID)),
     ForAll(
     Filter(
     GalleryName.AllItems,
     CheckboxName.Value
     ) As aCol,
     Collect(
     colQuote,
     {
     PID: aCol.ID, 
     Product: aCol.Title,
     Price: Value(aCol.PriceExVAT),
     HMCode: aCol.HMCode,
     Category: aCol.Category,
     ProductQuantity: 1,
     SubTotal: Value(aCol.PriceExVAT)*1
     }
     )
     )
    )

     

    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

  • drossi90 Profile Picture
    188 on at

    Thanks Warren. Can you talk me through what aCol is doing so I understand it please?

  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    Hi @drossi90 ,

    The As statement is simply a disambiguation operator - you can call aCol whatever you want. It is useful when you have the same field names in the source and destination.

  • drossi90 Profile Picture
    188 on at

    Thanks @WarrenBelz every day is a school day.

    I've went with your suggestion and modified slightly to the below. Works perfectly. Thanks again.

    If(
     IsBlank(
     LookUp(colQuote,Category = "System Pack")),
     ForAll(
     Filter(
     BoilerFittingsPack,Category="System Pack") 
     As BoilerFittings,
     Collect(
     colQuote,
     {PID:BoilerFittings.ID,
     Product:BoilerFittings.Title,
     Price:Value(BoilerFittings.PriceExVAT),
     HMCode:BoilerFittings.HMCode,
     Category:BoilerFittings.Category,
     ProductQuantity:BoilerFittings.ProductQuantity,
     SubTotal:Value(BoilerFittings.PriceExVAT)*Value(BoilerFittings.ProductQuantity)})))

     

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard