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 / When checkbox is selec...
Power Apps
Unanswered

When checkbox is selected add row in gallery

(1) ShareShare
ReportReport
Posted on by 559

Hi all,

I have two galleries Phase gallery(1st) which has check box which when selected it will add row into the next gallery. On "+" icon rows are added to the second gallery. 

On + code:

ForAll(
Sequence(countitems) As Sequence Number,
Collect(
colFinalPhase,
{
ID: Last(colFinalPhase).ID + 1,
'Project Name': prjnames_3.Selected.ProjectName,
Phase: Title2_4.Text, --(When check box is selected that respect phase value will be collected in the label)
'Work Product/Process': Last(
FirstN(
ComboBox6_5.SelectedItems,
SequenceNumber.Value
)
).'Work Product/Process'
}));

On check of check box: Set(countitems,0);Set(countitems,Sum(CountRows(ComboBox6_5.SelectedItems),countitems));

When user selected 2 check box at the same time the last selected check box alone display in the label. My requirement is when user selects 2 check box at the same time both the Phases(1st gallery) must be displayed in the Phase label and rows will be added based on the selected value.

 

Any help/suggestion on this.

Thanks in advance.

 

Screenshot (113)_1.png
Categories:
I have the same question (0)
  • M_Ali_SZ365 Profile Picture
    1,110 on at

    Hi @Uthhra ,

    To add rows in a second gallery based on selected checkboxes in the first gallery:

    Collect selected phases when a checkbox is checked:

    Collect(SelectedPhases, {Phase: ThisItem.Phase})

    Remove unselected phases when a checkbox is unchecked:

    Remove(SelectedPhases, ThisItem)

    On "+" icon press, add collected phases to the second gallery:

    ForAll(
    SelectedPhases,
    Collect(
    colFinalPhase,
    {
    ID: Last(colFinalPhase).ID + 1,
    'Project Name': prjnames_3.Selected.ProjectName,
    Phase: Phase
    // Add other fields as needed
    }
    )
    )

    Replace ThisItem.Phase with the actual data field from your first gallery and adjust field names as per your schema.

    Fuel our success! 🚀 Give a thumbs up and click 'Solution Accepted' to supercharge our community. Your actions speak volumes!
    Warm regards,
    Muhammad Ali

  • Sri Profile Picture
    559 on at

    Hi @M_Ali_SZ365 

    As per your code I cannot give ForAll (Selected Phases) because when checkbox is checked there is a combo box which loads values and I am using sequence to count items from the combo box when checkbox is checked. 

  • M_Ali_SZ365 Profile Picture
    1,110 on at

    @Uthhra ,

    Try This 

    To add rows to a second gallery based on selected checkboxes and ComboBox values, use this approach:

    For the Checkbox OnCheck and OnUncheck properties:

    Add the phase to a collection with ComboBox values when checked:

    Collect(colSelectedPhases, {Phase: ThisItem.Phase, RelatedItems: ComboBox.SelectedItems})

    Remove the phase from the collection when unchecked:

    Remove(colSelectedPhases, LookUp(colSelectedPhases, Phase = ThisItem.Phase))

    For the ComboBox OnChange property:

    Update the related items in colSelectedPhases for the respective phase:

    Patch(colSelectedPhases, LookUp(colSelectedPhases, Phase = ThisItem.Phase), {RelatedItems: ComboBox.SelectedItems})

    On "+" icon press:

    Use nested ForAll to iterate over selected phases and their related items to add to the second gallery:

    ForAll(
    colSelectedPhases,
    ForAll(
    RelatedItems,
    Collect(
    colFinalPhase,
    {
    ID: Last(colFinalPhase).ID + 1,
    'Project Name': prjnames_3.Selected.ProjectName,
    Phase: Phase,
    'Work Product/Process': 'Work Product/Process' // Replace with actual field
    }
    )
    )
    );

     

     

    _________________________________________________________________________________________________________________________

    If my post helped, please mark it as Accept as solution to help others find it. A Thumbs Up would also be appreciated if you found it useful. 

    Warm regards,
    Muhammad Ali

     

     

  • Sri Profile Picture
    559 on at

    @M_Ali_SZ365 ,

    On check of the checkboxes the code which I gave I have attached as screenshot. Different Phase loads for each project.  is the one in the Phase gallery(Label) which displays all the Phases value. 

    Combo box items: Filter(
    Work_Product_Master,
    PhaseNames = Title2_4.Text(Label which holds the Phases)
    ).'Work Product/Process'

    On Uncheck property: 

    I gave the code and it is giving me error: Remove(SelectedPhases, ThisItem)

    "Incompatible type. The collection can't contain values of this type."

    Screenshot (114)_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 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard