cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dlabar
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
mdevaney
Super User III
Super User III

@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
mdevaney
Super User III
Super User III

@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

@Dlabar

We did it?!?

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

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 the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (52,714)