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 rows to gallery
Power Apps
Answered

Add rows to gallery

(0) ShareShare
ReportReport
Posted on by 559

Hi All,

I have a gallery where a check box and combo box is there. When check box is selected that respective value loads in the Combo box. For Ex. (If the check box value is design then combo box value has 3 items and  If the check box value is development then combo box value has 1 items). 

When + icon is clicked I want to load rows in gallery based on the check box selected and the items in the combo box. For Eg. (if check box value selected value is design & development  then the combo box will be having total of 4 values. So 4 rows must be added in the gallery). 

The code now written in the + icon is:

Collect(colFinalPhase,Patch, Patch(varNewPhaserecord,{ID: vartest, 'Project Name': prjnames_3.Selected.ProjectName}));

I need to load the rows in this gallery which has collection name as colFinalPhase which is above. 

This vartest is a set variable to collect the number of checkbox collected in the gallery.

Set(vartest, CountRows(Filter(Gallery2.AllItems,Checkbox2.Value = true)));

Any idea/suggestion how this can be implemented.

Screenshot (80)_1.png
Categories:
I have the same question (0)
  • Verified answer
    v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @Uthhra ,

     

    Do you want to create this number of rows into the collection after getting the total number of options for Combo box with a value of true checkbox in the gallery? Please try this:

    1)Set the variable to get total number of combo box Items:

    Set(contR,0);

    The property of check box in gallery:

    OnCheck:Set(contR,Sum(CountRows(ComboBox.SelectedItems),contR));
    OnUncheck:If(contR>0,Set(contR,contR-CountRows(ComboBox.SelectedItems)))

    2)The property of button:

    ForAll(Sequence(contR), Collect(colFinalPhase,{ID:expectedValue1,'Project Name':expectedValue2}))

    vmengmlimsft_0-1696574553975.png

     

     

    Hope this helps you!

    -----------------------------------------------------------------------------------------------------------------------------------

    If my answer solves your problem, please accept it as a solution to help more people stuck on the same problem find it.

     

    Best regards,

    Rimmon Li

  • Sri Profile Picture
    559 on at

    @v-mengmli-msft 

    If I use Set variable in Items of combo box. I'm getting an error, "Behavior function in a non-behavior property. You can't use this property to change values elsewhere in the app".

  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @Uthhra ,

     

    Set is a behavior function, you can't put it on the Items property, you should put it on a property like OnSelect, and the property that can put the behavior function is usually on the button, such as button, check box, etc.

     

    Hope this helps you!

    -----------------------------------------------------------------------------------------------------------------------------------

    If my answer solves your problem, please accept it as a solution to help more people stuck on the same problem find it.

     

    Best regards,

    Rimmon Li

     

  • Sri Profile Picture
    559 on at

    @v-mengmli-msft 

    It is working now. But whatever is selected in the checkbox gallery. How to display the values in the colFinalPhase gallery. For Ex. The value Onboarding must display in the Phase column of the colFinalPhase and combo box selected items must display on the Work Product column in colFinalPhase. Is there a way to do it?

  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @Uthhra ,

     

    What does "display" mean? Do you want to use a function like Patch to save Combo box's options to a column in colFinalPhase collection?

     

    Best regards,

    Rimmon Li

  • Sri Profile Picture
    559 on at

    @v-mengmli-msft 

    In the above checkbox gallery which ever check box is selected that respective checkbox and combo box items must be added to the below gallery where there are two columns called Phase and Work product. When the row is added these details must also be added to the below colFinalPhase gallery.

    The check box gallery gets the values from different list and the items of the gallery is 

    Distinct(Phasenames,Phase)

    Screenshot (81)_1.png
  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @Uthhra ,

     

    Are controls in Phase and Work product dropdown? If you want to add rows when the check box is selected, please try this:

    I assuming they are dropdown.

    Set the OnCheck of check box:

    ForAll(ComboBox.SelectedItems As C,Collect(colFinalPhase,{Phase:Checkbox6.Text,'Work product':Table(C)}))

    The result of my test:

    vmengmlimsft_1-1696581061497.png

     

    After selecting the "4".

    vmengmlimsft_2-1696581081348.png

     

     

    Hope this helps you!

    -----------------------------------------------------------------------------------------------------------------------------------

    If my answer solves your problem, please accept it as a solution to help more people stuck on the same problem find it.

     

    Best regards,

    Rimmon Li

  • Sri Profile Picture
    559 on at

    @v-mengmli-msft 

    Yeah Phase and Work Product in colFinalPhase gallery are dropdown. When checkbox is selected Phase is getting displayed but the Combo box values are not getting displayed in the colFinalPhase gallery when row is added.

  • v-mengmli-msft Profile Picture
    Microsoft Employee on at

    Hi @Uthhra ,

     

    Could you please show me the code in your check box now and the Items of your Combo box and dropdown?

     

    Best regards,

    Rimmon Li

  • Sri Profile Picture
    559 on at

    @v-mengmli-msft

    whatever code I have given in the checkbox I have attached in the screenshot. The code in the Add row icon is

    ForAll(ComboBox6.SelectedItems As C,Collect(colFinalPhase,{Phase:Title2.Text,'Work product':Table(C)}));

    In the colFinalPhase gallery the Phase and Work Product dropdown Items are attached in screenshot.

    This Table C where should I give it?

    Screenshot (82)_1.png
    Screenshot (83)_2.png
    Screenshot (84)_1.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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard