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
Super User

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
Super User

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
Super User

Re: How to resolve a naming conflict in a Filter

@Dlabar

We did it?!?

Highlighted
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
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response 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 (4,984)