cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MVP

How to resolve a naming conflict in a Filter

I had this code:

Filter(ProductsForAssessmentCol,
	        'Protection Level Recommendation'.'Is Selected' = true
	        && Status = OS.productRecommendation.status.active
	    )

But the ProductsForAssessmentCol was an in memory collection and the user had updated the "Protection Level Recommendation.IsSelected value in a different collection, so I basically needed to join to this other in memory collection in order to check that value, rather than the value of the record in the current collection.

 

This is what I came up with, but there has to be a better way:

AddColumns(
    Filter(ProductsForAssessmentCol,
        Status = OS.productRecommendation.status.active
    ), 
    "recommendationSelected",
    With(
        { recommendationLevel: 'Protection Level Recommendation' }
    ,
        LookUp(ProtectionLevelCol, 'Protection Level Recommendation' = recommendationLevel.'Protection Level Recommendation')
            .'Is Selected' = true
    )
)


Maybe I just don't know how to use [@NAME] correctly to distinguish between the name of the item in the filter vs the name of the item in the LookUp?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: How to resolve a naming conflict in a Filter

@Dlabar 

I took a crack at rewriting your code but I don't have the data to test it against.  Does this work in your environment?  Do you feel i it is any better or worse than what you currently have?

 

AddColumns(
    Filter(ProductsForAssessmentCol, Status = OS.productRecommendation.status.active), 
    "recommendationSelected",
    LookUp(
        ProtectionLevelCol,
        'Protection Level Recommendation' = ProductsForAssessmentCol[@'Protection Level Recommendation']
    ).'Is Selected' = true
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: How to resolve a naming conflict in a Filter

@Dlabar 

I took a crack at rewriting your code but I don't have the data to test it against.  Does this work in your environment?  Do you feel i it is any better or worse than what you currently have?

 

AddColumns(
    Filter(ProductsForAssessmentCol, Status = OS.productRecommendation.status.active), 
    "recommendationSelected",
    LookUp(
        ProtectionLevelCol,
        'Protection Level Recommendation' = ProductsForAssessmentCol[@'Protection Level Recommendation']
    ).'Is Selected' = true
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Highlighted
Super User III
Super User III

Re: How to resolve a naming conflict in a Filter

@Dlabar

We did it?!?

MVP

Re: How to resolve a naming conflict in a Filter

Yep, only change was I put the thing I'm attempting to find on the left, and the thing I have on the right.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,206)