cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dlabar
Level 8

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

Super User
Super User

Re: How to resolve a naming conflict in a Filter

@Dlabar

We did it?!?

Dlabar
Level 8

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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,231)