Skip to main content

Notifications

Community site session details

Community site session details

Session Id : whRqgHlrcd7AAkbTEntbNk
Power Apps - Building Power Apps
Answered

Filter for self referential lookup not working

Like (0) ShareShare
ReportReport
Posted on 8 Sep 2020 08:03:17 by 145

I have 2 Custom Entities:

1. Question

2. Group

 

Question Entity: Has a Lookup to Group Entity

Below is the fields for Question Entity

Field NameDataType
GroupLookup to Group

Group Entity: Has 2 Lookup to Group Entity

Below is the fields for Group Entity

Field NameDatatype
Next GroupLookup to Group
Previous GroupLookup to Group

Now I am filtering the gallery based on Collection. Below is the code of the Collection:

 

ClearCollect(
 NextQuestion,
 Filter(
 Questions,
 'App selector'.'App selector' = appSelector.'App selector' && IsBlank(Group.'Previous Group')
 )
)

 

There is a button called "Next" which will load next set of Questions for the same collection.

I want to filter the collection based on "Next Group" field in the Group. Below is the Code.

 

ClearCollect(
 NextQuestion,
 Filter(
 Questions,
 'App selector'.'App selector' = appSelector.'App selector' && Group = QuestionList.Selected.Group.'Next Group'
 )
 )

 

"QuestionList" is the name of the gallery. This is giving me the following error "multiple levels of many-to-one relationship expansion aren't supported".

 

Is there a way I can achieve this?

 

Any help is appreciated.

 

  • Verified answer
    v-bofeng-msft Profile Picture
    on 09 Sep 2020 at 06:20:21
    Re: Filter for self referential lookup not working

    Hi @tjalui :

    Could you tell me:

    • What is Groups's Primary Name field?I assume it is "Name"(Because I need a unique identifier to locate the specified record)

    1.jpg

    Firstly,let me explian why you encounted this problem.

    The reason for the error is as you said "multiple levels of many-to-one relationship expansion aren't supported".

    Secondly,You can eliminate "multiple levels of many-to-one relationship expansion" by nesting another LookUp.

    For example:

     

     

    Filter(
     Questions,
     Group.Name = LookUp(
     Group,
     Name = QuestionList.Selected.Group.Name
     ).'Next Group'.Name
    )

     

     

    • Use LookUp to find the eligible record in the entity Group and get its associated'Next Group'
    • Filter Question records through the records obtained in the first step

    Best Regards,

    Bof

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

Overall leaderboard