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 / how to collect a dupli...
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:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    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!

  • dixonbridgeta Profile Picture
    125 on at

    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,516 Moderator on at

    @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

    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,516 Moderator on at

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

  • dixonbridgeta Profile Picture
    125 on at

    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.

  • dixonbridgeta Profile Picture
    125 on at

    Any other ideas?

  • LaurensM Profile Picture
    12,516 Moderator on at

    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

    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,516 Moderator on at

    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.

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 316 Most Valuable Professional

#2
11manish Profile Picture

11manish 242

#3
Valantis Profile Picture

Valantis 198

Last 30 days Overall leaderboard