cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

Filtering Child Dataverse records based on relationship

Hi,

 

I am trying to solve this problem but not having much luck:

 

Table: Table1

Field: Name

Field: Weekending

 

Table: Table2

Field: lu_Table1 (Relationship Column)

Field: Activity

 

Relationship One-To-Many Table1>Table2

 

My app uses the current week to get a single record from Table1 and stores it in variable 'current_record' I then want a gallery to display all records from Table2 where lu_Table1 = current_record. I have tried the below but I get an Invalid Argument Type error and a Delegation warning, how should I be approaching this?

 

Filter(Table2, lu_Table1 = current_record)

 

TIA

1 ACCEPTED SOLUTION

Accepted Solutions
Regular Visitor

I finally found a solution to this, for anyone else struggling, the reason its not immediately clear because the intellisense in Power Apps doesn't prompt for all the data available which includes the Unique Identifier Field.

 

The simple way here is to use the Unique Identifier of the record in the table via the relationship column, to do this you reference it by the name of the table as the field. See below:

 

Set(current_record, Lookup(Table1, Weekending = DateTime.Selected); 

 

Filter(Table2, current_record.Table1 = lu_Table1.Table1)

 

so the current_record holds a single record from Table1, current_record.Table1 returns the GUID of that row. In the filter we compare that to the GUID of the relationship field in Table 2 lu_Table1.Table1.

View solution in original post

1 REPLY 1
Regular Visitor

I finally found a solution to this, for anyone else struggling, the reason its not immediately clear because the intellisense in Power Apps doesn't prompt for all the data available which includes the Unique Identifier Field.

 

The simple way here is to use the Unique Identifier of the record in the table via the relationship column, to do this you reference it by the name of the table as the field. See below:

 

Set(current_record, Lookup(Table1, Weekending = DateTime.Selected); 

 

Filter(Table2, current_record.Table1 = lu_Table1.Table1)

 

so the current_record holds a single record from Table1, current_record.Table1 returns the GUID of that row. In the filter we compare that to the GUID of the relationship field in Table 2 lu_Table1.Table1.

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Check out the Power Apps Community Call for January 2021

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (4,408)