cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TrulsB
Advocate II
Advocate II

Filter CDS with related fields in Canwas app gallery

I have two tables in CDS.  Projects and tasks.   There is a relation between Projects:Projectname and Tasks:Project.

 

I have one gallery in my Canvas app for "Projects"(ProjectGallery) and one gallery for "Tasks"(TaskGallery).   When i select a project (Thisitem.IsSelected) i like to filter the Tasks gallery, so i only see thasks that is related to the acutal project in the task table, without getting delegation warning. 

 

In "Tasks" the Project field is a lookup field.  In "Projects" is the primary name (text). Any idea how the correct: Filter(Tasks;.....) should be like to select related fields without delegation warning. 

cds-filter.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
EricRegnier
Super User
Super User

Hi @TrulsB,

Would it be possible to share your current filtering expression? The project's primary name is text but that's just what is displayed instead of the displaying the primary key. Behind the scenes, the Project record primary ID/key (GUID) is saved on Tasks so you'll have to filter with that. Here's an example:

TaskGallery.Items = Filter(Tasks, Project.PrimaryId = ProjectGallery.Selected.PrimaryId)

 Hope this helps!

View solution in original post

3 REPLIES 3
EricRegnier
Super User
Super User

Hi @TrulsB,

Would it be possible to share your current filtering expression? The project's primary name is text but that's just what is displayed instead of the displaying the primary key. Behind the scenes, the Project record primary ID/key (GUID) is saved on Tasks so you'll have to filter with that. Here's an example:

TaskGallery.Items = Filter(Tasks, Project.PrimaryId = ProjectGallery.Selected.PrimaryId)

 Hope this helps!

TrulsB
Advocate II
Advocate II

Hi,

my filter is project-filter.JPG

With this filter it do now show the records in TaskGallery i, and i also get an delegation warning. 

 

Without filter it looks like this: 

projects-skjerm.JPG

 

With filter it looks like this:

project-withfilter.JPG

 

My database tables look like this.  Norwegian "Oppslag" in Tasks, =  Lookup 🙂

project-task.JPGproject-projects.JPG

 

It must be somthing im missing here?

I have problem With reply to you, please look into the case

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (2,218)