cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
StuCundy
Post Patron
Post Patron

Navigate to new Gallery and show only those child records from ThisItem

Hi there

 

I have a gallery showing items from a SP list.  I would like to click on the selected Item and then navigate to a new gallery to show all child records of that selected item in a new Gallery.  Not sure where to start. 

 

I have Gallery1 showing Students and I can navigate to gallery2 showing reports for all students.  I can filter this gallery to see reports for just one student via a dropdown, however  I would like to filter by the report gallery by the student when I click on see reports on their gallery1 item.

 

If someone could please point me in the right direction I would appreciate it.

 

11 REPLIES 11
leyburn19
Memorable Member
Memorable Member

Every SP record has a unique ID.  When you create the child record,  have it store the master ID in a Column for it.  I do this by have a column in the child and then when I create a new child record,  I capture the master ID somehow in a variable and I make this the default for the field and then hide it so user does not know.

 

Then when navigating to a child from a parent you set a variable at that time to the ID and do the child galley filter based on that

v-yutliu-msft
Community Support
Community Support

Hi @StuCundy ,

Do you want to filter list2 based on selected item in list1?

Could you tell me:

1)these two lists' relationship?

2)the student field's data type in list1 and list2?

I assume that :

1)in list1, you have a student field (data type: text)

2)in list2, you have a student field(data type: lookup field ,related to the student field in list1)

If so, try this:

1)gallery1's Items:

list1

2)gallery2's Items:

Filter(list2,student.Value=Gallery1.Selected.student)

Then gallery2 will only display the reports based on the selected student.

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Guys @v-yutliu-msft @leyburn19 

 

Yes I have now got the child gallery functioning by using 

Filter(StudentReport, StudentID=StudentListBrowseGallery.Selected.ID)

I now wish to create a new record with the same  StudentID would I enter that in the new form creation function below somehow? 

 

NewForm(StudentReportEditForm);Navigate(StudentReportEditScreen, ScreenTransition.None)

 

What I do is have one Form that is for view, edit and new.  This means I need to select the student name from the gallery.  When selecting I set a variable with the ID.  In your case you now have a list of many matching records.  I then have a + on that view to create a new record.  So when this is clicked and the form is in new mode,  I get all the relevant fields to do data input.  I make sure the ID filed that this all matches back to the master is one of the Fields on the form.  I set the default for this field to be the variable not parent.default.  It makes no difference if the form is in edit mode as the variable is always the same.  I then hide that field.  When the form is submitted that field store the number you need to match

Hi @StuCundy ,

If you want to create a new record by using the selected id, you just need to set the stduent id textinput(inside the edit form)'s Default to:

StudentListBrowseGallery.Selected.ID

 

 

Best regards, 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yutliu-msft 

 

I will go down this track first.  So I have the Student gallery.  I use the following to get the selected items in the report gallery

Filter(StudentReport,StudentTitle=StudentListBrowseGallery.Selected.Title)

So my connector with the student list is to select the "Title" from within the Student Report form using a Lookup dropdown.  "StudentTitle" in the Report form.  I do populate the studentID with a lookup too on the report form using

I do get a list of all the reports relating to that student.

When I go to view  the report its good but its says connect to data, like its lost the connector.

noconnect.png

 

Also when I click to Edit Its a different report.  I know its all to do with the Title=StudentTitle connection but I'm puzzled.

My Edit button OnSelect is "EditForm(StudentReportEditForm);Navigate(StudentReportEditScreen, ScreenTransition.None)"

 

 

What at are the properties on the Form.

 

datasource = SPList

Items = Lookup(SPList,Titel=StudentTitle)

 

Also what is stored in the Title Column?  You can be in danger of duplicates as student can have same names,  particularly surname.  I would also be concerned with the 2000 records limit.  It is feasible that a unique name will be entered that is not picked up in the maximum 2000. Using unique numeric ID caters for every possibility

Hi @leyburn19 

 

I'm currently working through this video from Laura Rogers so things are starting to make sense kind of. https://jobs.collab365.community/powerapps-and-related-lists/#4

 

So I know I can use ID in the student list for the unique name however I have used the Title as a populated combination of names and ID e.g "Name_ID##"

 

Not worried about the delegation issue as numbers are few

That would work,  but you would still have issues with a dropdown to select as it will simply grow and depending on the ID position may sort based on that as text.  You names will also be all over the pace.  Combo might help with that. 

 

My preference is to look at it completely differently.  I would have two galleries and form to do this.  Could be all on one view.

 

Gallery one is list of students.  When a student is selected,  gallery 2 appears or you navigate to it.  In the onselect I would simply have a variable Set(varID,ThisitemID).  Now on gallery2 it is filetered based on second source and finds and data where the varID = Special ID column (not its ID) This ID column is populated with the varID when a new record is created.

 

No in the second gallery.  If you want to edit an item,  It simply takes you to an adit form based on the same source items using Gallery?.Selected in its item property.  This form has the Special ID as a hidden Field that has a default of the VarID.  You can edit and save.  If you want to create a new record have an add button or a plus in the header to the second gallery.  This simply turns the edit form to a new form.  Fill in the form and submit.  As the hidden form has the VarID already,  this will now match it with the records in the second gallery and appear in your list

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,817)