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 / Linking Parent and chi...
Power Apps
Unanswered

Linking Parent and child galleries through clicks in canvas app

(0) ShareShare
ReportReport
Posted on by 8

I have a scenario where I want to look at the child records of an parent tables record. I.e. I have table called Timesheets and a child table called Timesheet Items

 

The Primary Key and Look up are both called Timesheet Item. For the life of me I can't get the following formula to work so that when I click through from gallery 1 (Timesheets) to Galley 2 (Timesheet Line Items) it filters only the Timesheet Line Items where the PK/LK is the same as the selected Timesheet. I am using the following formula:

 

Filter('Timesheet Line Items',AsType('Timesheet Item',[@Timesheets]).'Timesheet Item' = Gallery.Selected.'Timesheet Item')

 

Now I now that the concept behind this formula works as I tested it on an App with Accounts and Contacts using the following formula:

 

Filter(Contacts,AsType('Company Name',[@Accounts]).'Account Name' = BrowseGallery1.Selected.'Account Name')

 

Can anyone help me understand what I am doing wrong?

 

 

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Giver 

    SharePoint or Dataverse?

  • Giver Profile Picture
    8 on at

    Dataverse

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Giver 

    If you have established the relationships you can make the Items property of your child gallery

    Gallery1.Selected.Timesheet

  • Sunil-Narnaware Profile Picture
    681 on at

    @Giver  The 'AsType' is not required in your case because 'Timesheet' lookup that you created on Timesheet Items is not a polymorphic one.. Polymorphic means it can hold different types of records in one single lookup.. for example.. your second formula which you referred

    Filter(Contacts,AsType('Company Name',[@Accounts]).'Account Name' = BrowseGallery1.Selected.'Account Name')


    Needs to use AsType as Company Name can be Account as well as Contact.

    In your case, what @Drrickryp has suggested, is the most simple way to filter your second gallery based on first gallery instead of using Filter Condition. 
    else you can use Filter like below

    Filter('Timesheet Items', Timesheet.Name = Gallery1.Selected.Name) //Gallery1 points to Timesheet Table.. Right?

    Replace with appropriate field names.. Please make sure the field names are appropriate.. I am little doubtful if your primary key name & lookup name are same.. so double check this..

    Regards,

    Sunil

  • Giver Profile Picture
    8 on at

    Hi Sunil,

     

    Thank you for that explanantion. I have followed the suggested method but am still coming up with errors.

     

    PK on Timesheet is: 'Timesheet Item' : 

    Giver_0-1654851845604.png

    The lookup value to parent timesheet on timesheet line item is: 'Timesheet Item'

    Giver_1-1654851948748.png

     

    Her is the error:

    Giver_2-1654852126617.png

     

     

  • Sunil-Narnaware Profile Picture
    681 on at

    @Giver What is the error you are seeing when you hover over = (underlined with red color) ? Can you please share that?

  • Giver Profile Picture
    8 on at

    Giver_0-1654876614903.pngGiver_1-1654876651920.png

     

  • Sunil-Narnaware Profile Picture
    681 on at

    Can you try this ? In Gallery galTimesheetItems' items property.. write 'galTimesheets.Selected.'Timesheet Line Items' and see if you can only see selected timesheet' timesheet line items in second gallery..

  • Sunil-Narnaware Profile Picture
    681 on at

    @Giver Can you try this ? In Gallery galTimesheetItems' items property.. write 'galTimesheets.Selected.'Timesheet Line Items' and see if you can only see selected timesheet' timesheet line items in second gallery..

  • Giver Profile Picture
    8 on at

    Hi @Sunil , No luck although the formula is error free:

     

    Giver_0-1655111791801.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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 893

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 482

Last 30 days Overall leaderboard