web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Screens Check box Gall...
Power Apps
Answered

Screens Check box Gallery sourced from 2nd table, how to relate

(1) ShareShare
ReportReport
Posted on by 107
I Recently had to make the decision to change my data sources from Dataverse to Sharepoint lists (our licensing is corporate controlled we cant change it)
 
I have a screen in my app where the Recordsgallery and form are tied to a sharepoint list lets call it table 1 but outside the form I have a check box gallery that is its datasource is tied to another sharepoint list called Table 2, the checkbox is called checkbox 1
 
The reason for this is when  a record is created for table 1  a list of choices in the check box gallery has to be dynamic based on the value selected in a field in the form. this seperate check box galleries function is to be a part of a patch that creates child records in a 3rd table. the check box gallery can be anywhere from 2 to 100 check boxes depending on item chosen in the form. 
 
Previously i was able to accomplish this with M2M relationship and Relate\unrelate functions but since I switched to share point list i lose the m2m ability (unless theres something im missing) 
 
I can get the gallery to fill and dynamically change with the forms field selection but i can not get the check boxes to stay selected or unselected when selecting other records. 
 
since it seems i can not use Relate\unrelate functions in my checkbox in the gallery anymore 
 
what would I need to change to reestablish the functionality of this checkbox gallery in order to 
select multiple boxes
still utilize a Select all and Deselect all button already in the form 
I should be able to adjust my Patch function in onsuccess once i get over this hurdle. 
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
    Hi,.
     
    Let's walk this through
     
    1) A checkbox's value is setup by the Default property
    which is either 
    Blank,
    Default.Parent
    Some Expression you put in, whether its a lookup or filter or whatever.
     
    2) let's say you have your Gallery 1
    And you know want Gallery 2 to be filled based on the row you selected in Gallery 1
    And, before you save or whatever you are doing, you want them to be able to select another row and fill in either
    a) MORE checkboxes and treat them ALL as part of the first rows selection
    or
    b) you want to track which checkboxes are set for "each row" in Gallery 1
     
    I am going with b) above
     
    1) Create your Gallery for Gallery 1
    -Make sure you have whatever the Row ID is from SharePoint, or whatever Unique Identifier you have in some Column in Source 1.
    I am going to pretend its an alpha character, A,B,C,D,E etc
     
     
    2) Now you need a collection. You need some kind of Unique ID for the Check box gallery rows as well. whatever they are
    I am going to PRETEND its simply a number 1,2,3,4 whatever
     
    3) We need the following
    -The Unique ID of a Row in Gallery 1
    -the unique id of the checkbox row
     
    4) Now when someone Checks a CheckBox in Gallery 2 we do this in the OnCheck
     
    Now I could do this with a Collection within a Collection but I made it simple.
    Essentially we need to build a Collection that has
    1. A property that has the unique ID from Gallery 1
    2. A property that has the unique ID from Gallery 2
     
    So let me show you a real-world example now
    -I have Gallery1Values
    -I have Gallery2Values
    -I have Gallery1 Text Label
    -1 I have Gallery2CheckBox
     
    My Collection is called CheckedValues.
     
    3.I have a screen and in the OnVisible I have
    Clear(CheckedValues).
     
    4. In the OnChecked of Gallery 2, for my Gallery2CheckBox (yes thats its name, sue me ;-) )
    //this will add the currently selected Gallery 1
    // with the currently checked gallery 2 checkbox values
    Collect(CheckedValues,
        {
            Gallery1Value: Gallery1Values.Selected.Gallery1LabelValue.Text,
            CheckBoxValue:  Gallery2Values.Selected.Gallery2CheckBox.Text
        }
    )
     
     
     5. In my OnUncheck of Gallery 2 for the Gallery2CheckBox I have
     
    //This removes the CheckBox record so that it will NOT show
    // up as checked for the selected Gallery 1 record any more
    Remove(CheckedValues,
            LookUp(CheckedValues,
                CheckBoxValue = Gallery2Values.Selected.Gallery2CheckBox.Text
                And Gallery1Value = Gallery1Values.Selected.Gallery1LabelValue.Text)
        )
     
     
    6. In my Default I have
    // This will make it checked if the gallery 1
    // and gallery 2 are in the Collection
    !IsBlank(LookUp(CheckedValues, Self.Text = CheckBoxValue
        And Gallery1Value = Gallery1Values.Selected.Gallery1LabelValue.Text)
    )
     
    Now I will show an example, where I will select 1-4 for A, and 2-3 for B and 1 and 4 for C
     
    Nothing at first
     
    Then I select for all I said above. Then I will swap back and forth so you know I changed rows after my selections
     
    So the pictures represent me moving from row to row and it checks or unchecks what I picked for A,B,C Gallery 1
     
     
    And Done
     
    Now if you want to patch them and stuff please open another question as this answers what you wanted and was work to do.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard