cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Hosto
Level: Powered On

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

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




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

3 REPLIES 3
Super User
Super User

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




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

Hosto
Level: Powered On

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!

Super User
Super User

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 😺




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (3,568)