web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / This rule creates a ci...
Power Apps
Suggested Answer

This rule creates a circular reference between properties

(0) ShareShare
ReportReport
Posted on by 6
Hi there, I have a canvas app that, up until today, has been working fine, no changes were made to the code. When I logged in today, none of my data was showing, and after opening the app in the editor, I am greeted with an alert on my gallery that says. "This rule creates a circular reference between properties."
 
Below is the code. Can anyone spot where this loop may be caused?
 
If(varSort = true,
If(
    SortByStatus = true,
    Sort(
        Filter(
            Projects,
            Status = SortStatusDrop.Selected.ID,
            Status > 1,
            Status < 11
            Or Status = 13
        ),
        Status,
        SortOrder.Ascending
    ),
    If(
        SortByEmp = true,
        Sort(
            Filter(
                Projects,
                Production = SortEmpDrop.Selected.EmpNo,
                Status > 1,
                Status < 11
                Or Status = 13
            ),
            Status,
            SortOrder.Ascending
    ))
),
If(
        Searchbar.Selected.ID = Blank(),
        Sort(
            Filter(
                Projects,
                Status > 1,
                Status < 11
                Or Status = 13
            ),
            Status,
            SortOrder.Ascending
        ),
        Filter(
            Projects,
            Client = Searchbar.Selected.ID,
            Status > 1,
            Status < 11
            Or Status = 13
        )
    )
)
I have the same question (0)
  • Suggested answer
    MMcCloud Profile Picture
    357 Super User 2025 Season 2 on at
    Good Afternoon,
     
    I believe the reason you are seeing the error you are getting is because the Searchbar component is inside the Gallery Component you are searching with in which means its filtering the options by something available in the filtered options.

    Try pulling the Searchbar into a different section of the screen or under a different parent component.
     
    If this answers your question, please mark it as the solution if not, please feel free to follow up with more information I would be glad to continue helping.
     
    Have a good day!
  • WarrenBelz Profile Picture
    153,059 Most Valuable Professional on at
    Firstly@MMcCloud may be on the right track here - either one/more of SortStatusDrop, SortEMpDrop or Searchbar are inside the gallery or you have a calculated field in the gallery relying on the output of one/more of these.
    Also, you can condense your code a bit here. Firstly if the output of the filter will always be under your Data Row Limit, you can do this (note you posted Status in both filters instead of referring to EmpNo on one).
    With(
       {
          _Data:
          Filter(
             Projects,
             Status = SortStatusDrop.Selected.ID,
             Status > 1,
             Status < 11 Or Status = 13,
             Len(Searchbar.Selected.ID) = 0 Or Client = Searchbar.Selected.ID
          )
       },
       Sort(
          _Data,
          If(
             SortByStatus,
             Status,
             SortByEmp,
             EmpNo,
             ID
          ),
          SortOrder.Ascending
       )
    )
    If however it is possible for the record numbers to be bigger, you can do this
    If(
       SortByStatus,
       Sort(
          Filter(
             Projects,
             Status = SortStatusDrop.Selected.ID,
             Status > 1,
             Status < 11 Or Status = 13,
             Len(Searchbar.Selected.ID) = 0 Or Client = Searchbar.Selected.ID
          ),
          Status,
          SortOrder.Ascending
       ),
       SortByEmp,
       Sort(
          Filter(
             Projects,
             Status = SortStatusDrop.Selected.ID,
             Status > 1,
             Status < 11 Or Status = 13,
             Len(Searchbar.Selected.ID) = 0 Or Client = Searchbar.Selected.ID
          ),
          EmpNo,
          SortOrder.Ascending
       ),
       Filter(
          Projects,
          Status = SortStatusDrop.Selected.ID,
          Status > 1,
          Status < 11 Or Status = 13,
          Len(Searchbar.Selected.ID) = 0 Or Client = Searchbar.Selected.ID
       )
    )
    Note also that varSort seems a bit of a waste of time - if neither SortByStatus or SortByEmp are true, then varSort is also false.
     
    Please ✅ Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like ♥
    Visit my blog
    Practical Power Apps    LinkedIn  
  • Suggested answer
    CU09121751-0 Profile Picture
    6 on at
    @  how do i go about "pulling the Searchbar into a different section of the screen or under a different parent component."
     
    For referance here is my screen 
  • MMcCloud Profile Picture
    357 Super User 2025 Season 2 on at
     
    In the editor screen you posted your search bar is outside the gallery that's not it. @WarrenBelz might be on a better track with the calculation that calls both of them somewhere within the logic. It's really hard to identify but, wherever your gallery component is you need to drop it down and look underneath then look at the logic you are applying for the items. Something with the way one of the fields either Searchbar or SortTypeDrop is being reference is causing a double reference kind of the like the Spiderman pointing meme.
  • WarrenBelz Profile Picture
    153,059 Most Valuable Professional on at
    Just a thought, take all of them out of the component onto the screen, ensure they reference correctly and see if you still get the error.
  • CU09121751-0 Profile Picture
    6 on at
    I did some digging and the issue seams to pop up in the second half of my code
    If(
            Searchbar.Selected.ID = Blank(),
            Sort(
                Filter(
                    Projects,
                    Status > 1,
                    Status < 11
                    Or Status = 13
                ),
                Status,
                SortOrder.Ascending
            ),
            Filter(
                Projects,
                Client = Searchbar.Selected.ID,
                Status > 1,
                Status < 11
                Or Status = 13
            )
        )
    )
     
    anything in here that would be causing this?
  • CU09121751-0 Profile Picture
    6 on at
    @    @
     
  • WarrenBelz Profile Picture
    153,059 Most Valuable Professional on at
    What is the Items (in Text please) of SearchBar and what type of field is Status ? Also what is your data source type and are all the Labels in your gallery simply ThisItem.FieldName or are any using calculations/formulas ?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard