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

ClearCollect; AddColumn with Lookup retrieves the same value for all rows

Hi there,

 

I have 2 custom data entities in Dynamics Fin&Ops where entity A has ID(1) and Description columns and entity B has its own ID(2) and the ID(1) from the entity A columns. I am trying the following to create my own collection which consists of ID(2), ID(1) (basically entity B) but also looked-up Description from entity A associated with the corresponding ID(1).

 

ClearCollect(MyCollection, AddColumns(entity B, "MyDescription", LookUp(entity A, 'ID(1)' = 'ID(1)').Description));

 

I am getting the collection created with the added "MyDescription" column, but each row has the same Description retrieved although each ID(1) has a different Description. I suspected it was because the columns are called the same ('ID(1)') and the logic gets confused - this is when I experimented with AddColumns and RenameColumns to get the lookup to search against a column with different name but with the same content - the same result. I've also tried to collect the data from data entities and use those collections in my formula but again, same result. I may end up changing the data entity B itself to have the description already part of it but I feel I'm so close!

 

Thank you for any advice.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: ClearCollect; AddColumn with Lookup retrieves the same value for all rows

Hi!

 

You will need to use the disambiguation operator DataSource[@columnname] as this will distinguish between your two data sources, because you are correct in that it is only reading that ID(1) from the one data source! 😺

 

Details on disambiguation can be found here,

 

Cheers,

ManCat


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

3 REPLIES 3
Highlighted
Super User II
Super User II

Re: ClearCollect; AddColumn with Lookup retrieves the same value for all rows

Hi!

 

You will need to use the disambiguation operator DataSource[@columnname] as this will distinguish between your two data sources, because you are correct in that it is only reading that ID(1) from the one data source! 😺

 

Details on disambiguation can be found here,

 

Cheers,

ManCat


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

Highlighted
Frequent Visitor

Re: ClearCollect; AddColumn with Lookup retrieves the same value for all rows

Thanks ManCat - this worked!

 

For anybody who would find this helpful, I inserted the function like this:

 

ClearCollect(MyCollection, AddColumns(entity B, "MyDescription", LookUp(entity A, 'ID(1)' = entity B[@'ID(1)']).Description));

 

Awesome!

Highlighted
Super User II
Super User II

Re: ClearCollect; AddColumn with Lookup retrieves the same value for all rows

You're welcome! Glad I was able to help you resolve your issue 😺


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

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 (6,697)