Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

how to collect a duplicate item from gallery checkbox

(0) ShareShare
ReportReport
Posted on by 125

Hi again!

 I am trying to figure out how to collect a duplicate of an item from a gallery with a checkbox and dropdown.

Checkbox code (grabs the name of the disk and the pricing): 

 

Collect(TierDiskSelectionCol, {Result: Subtitle4_3.Text});
Collect(TierDiskPriceCol, {Results: Label11_11.Text});

 

dixonbridgeta_0-1689271419089.png 

 

Here is the result, however I selected 2 in my dropdown so I want each of these items to appear twice:

dixonbridgeta_1-1689271435294.png

 

Thanks!

 

 

Categories:
  • LaurensM Profile Picture
    12,510 Super User 2025 Season 1 on at
    Re: how to collect a duplicate item from gallery checkbox

    The ForAll indeed goes in the OnCheck property of the checkbox. At first sight, I don't see any issues with your code. The only thing that I find rather strange is the reference to a Form's DataCardValue instead of a regular dropdown control within your Gallery.

     

    Can you confirm that the collection (not the label) remains empty after using the OnCheck? You could try it with a new regular dropdown control added to your gallery.

  • dixonbridgeta Profile Picture
    125 on at
    Re: how to collect a duplicate item from gallery checkbox

    hmm that goes in the oncheck property of the checkmark right? Every time I do that, the two labels don't display, not even just one item like it did before.

    dixonbridgeta_0-1689686066308.png

     

     

    Properties for all:

     

    Label to display name:

    Concat(TierDiskSelectionCol, Result, ";" & Char(13))

     

    Label to display price:

    Concat(TierDiskPriceCol, Results, Char(13))

     

    checkbox oncheck: 

    ForAll(
    //Change Dropdown1 to the correct name of the dropdown in the gallery
    Sequence([@DataCardValue19_1].Selected.Value),
    Collect(TierDiskSelectionCol, {Result: Subtitle4_3.Text});
    Collect(TierDiskPriceCol, {Results: Label11_11.Text}))

     

    Dropdown:

    Onselect & onchange: false

    Items: 

    ["1","2","3"]

    OR

    //Choices([@'Application OnBoarding'].Number_x0020_of_x0020_Tier_x0020)

    Display&search fields: ["Value"]

  • LaurensM Profile Picture
    12,510 Super User 2025 Season 1 on at
    Re: how to collect a duplicate item from gallery checkbox

    Hi @dixonbridgeta,

     

    I did some further testing and my initial code should work. We could try to use the disambiguation operator for the dropdown:

    ForAll(
     //Change Dropdown1 to the correct name of the dropdown in the gallery
     Sequence([@Dropdown1].Selected.Value),
     Collect(TierDiskSelectionCol, {Result: Subtitle4_3.Text});
     Collect(TierDiskPriceCol, {Results: Label11_11.Text})
    )

     

    Since you are using a label, make sure that the label is actually large enough to display all of the records (you could also allow scrolling). For troubleshooting purposes you could temporarily add a gallery to the screen with either of the collections as the Items property. Since we are using a ForAll and a Sequence, we should see the correct amount of rows being added. (Make sure to clear the collection during test sessions)

     

    As a note, the separator for the Concat function should be written in the third parameter field. This makes sure that all rows except the last one ends with the separator.

    Concat(TierDiskSelectionCol, Result, ";" & Char(13))
    Concat(TierDiskPriceCol, Results, Char(13))

     

    I hope this helps!

  • dixonbridgeta Profile Picture
    125 on at
    Re: how to collect a duplicate item from gallery checkbox

    Any other ideas?

  • dixonbridgeta Profile Picture
    125 on at
    Re: how to collect a duplicate item from gallery checkbox

    I am using a datacard from a form and inside that card is a label with the text property of: 

    Concat(TierDiskSelectionCol, Result & ";"&Char(13))

     

    Same with the pricing, the label for that datacard is:

    Concat(TierDiskPriceCol, Results & Char(13))

     

    This way they both get records in my form and stored on SP.

  • LaurensM Profile Picture
    12,510 Super User 2025 Season 1 on at
    Re: how to collect a duplicate item from gallery checkbox

    Unfortunately I am unable to recreate that issue. How are you displaying the collected records? 

  • dixonbridgeta Profile Picture
    125 on at
    Re: how to collect a duplicate item from gallery checkbox

    I tried it with value() and without. Both in the oncheck property. No error messages, just doesn't work the required number of times. Only displays once.

  • LaurensM Profile Picture
    12,510 Super User 2025 Season 1 on at
    Re: how to collect a duplicate item from gallery checkbox

    @dixonbridgeta indeed it needs to be written in the OnCheck - is there a particular error you are receiving?

    Should the values within the dropdowns be text values and not number values, please try to change the sequence part to:

     

    Sequence(Value(Dropdown1.Selected.Value))
  • dixonbridgeta Profile Picture
    125 on at
    Re: how to collect a duplicate item from gallery checkbox

    hmm I tried that but it didn't work. This is for the oncheck property of the checkbox correct?

    Also, the drop down is a combobox from the SP list that provides, "1", "2", "3", with these properties:

     

    dixonbridgeta_0-1689275967652.png

     

  • LaurensM Profile Picture
    12,510 Super User 2025 Season 1 on at
    Re: how to collect a duplicate item from gallery checkbox

    Hi @dixonbridgeta,

     

    Try the following formula:

    ForAll(
     //Change Dropdown1 to the correct name
     Sequence(Dropdown1.Selected.Value),
     Collect(TierDiskSelectionCol, {Result: Subtitle4_3.Text});
     Collect(TierDiskPriceCol, {Results: Label11_11.Text})
    )

    Should you have written the numbers as text in the dropdown items property, you might need a Value() around the dropdown1.Selected.Value.

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard