cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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?!?

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (6,972)