cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LinnZawWin
Kudo Kingpin
Kudo Kingpin

Using the ClearCollect() Function in PowerApps does not Pull any Lookup Columns from Common Data Service (CDS) Data Source

When I Collect from CDS Data Source into Collection in canvas app designer, the lookup fields are not being populated even though I can see the lookup values when I bind the data source to the data table.
This is the sample formula that I used

ClearCollect(ContactCollection, ShowColumns(Contacts, "fullname", "createdby"))

And this is the output collection without any data in the lookup column.

Empty%2BCollection

Sometimes, the lookup columns show up and most of the times, they do not.

Is that a bug? And is there any fix/workaround solution for it?

2 ACCEPTED SOLUTIONS

Accepted Solutions

@JT_Corrin, @LinnZawWin, @v-siky-msft, @RezaDorrani

I have faced this issue as well. As a workaround, if you are using the lookup column somewhere in the app, it then works fine. So for example, add a gallery with the same entity as the Items property and then add a label that displays the lookup column's value. You can then hide the entire gallery. Try collecting again and it should have your lookup columns.

Let me know if this helps.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

View solution in original post

If I need to display data from a related entity, I usually do a lookup.

 

for example:

Entity1 is parent

Entity2 is child

Let’s say Gallery1 lists Entity2 child records, and I have some controls outside the gallery that need to display information from the selected record.  The information might need to be columns from the Entity2 record as well as its parent Entity1 record.

 

On select of the Gallery, I would set a variable for the selected record. Something like this:

 

Set(varRecord, Lookup([@Entity2], Entity2Id = Gallery1.Selected.Entity2Id)

 

Set(varParentRecord, Lookup([@Entity1], Entity1Id = varRecord.Entity2FieldName.Entity1Id)

 

That gives me 2 record variables to work with.

 

I usually also wrap those variable lookups with ShowColumns so that I can get the specific fields for the record that I want to work with. So, if there is a label or other control that needs to reference the column, I just make sure it’s included in the ShowColumns formula.

 

View solution in original post

12 REPLIES 12
RezaDorrani
Dual Super User II
Dual Super User II

@LinnZawWin 

 

Yes this definitely is a bug

I have observed the same thing as well

 

Most of the times I need to connect to the Lookup entity as well and then query to fetch the associated data

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

v-siky-msft
Community Support
Community Support

Hi @LinnZawWin

 

Yes, I also face the same issue.

Sometimes the table logo is displayed, sometimes it is empty, sometimes it can be invoked, sometimes it cannot reference the value.

It is really werid.

I ready to post this issue to Microsoft product team. If this issue is solved, I would reply here.

 

Best regards,

Sik

Thank you @v-siky-msft 

JT_Corrin
Helper II
Helper II

This is still an issue. Are there any developments in a fix?

@JT_Corrin, @LinnZawWin, @v-siky-msft, @RezaDorrani

I have faced this issue as well. As a workaround, if you are using the lookup column somewhere in the app, it then works fine. So for example, add a gallery with the same entity as the Items property and then add a label that displays the lookup column's value. You can then hide the entire gallery. Try collecting again and it should have your lookup columns.

Let me know if this helps.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

View solution in original post

@JT_Corrin, @LinnZawWin, @v-siky-msft, @RezaDorrani

I have faced this issue as well. As a workaround, if you are using the lookup column somewhere in the app, it then works fine. So for example, add a gallery with the same entity as the Items property and then add a label that displays the lookup column's value. You can then hide the entire gallery. Try collecting again and it should have your lookup columns.

Let me know if this helps.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

Hey @PowerAddict 

 

I have tried this and it works sometimes but it is inconsistent. I am still searching for a proper, production acceptable, solution.

 

Cheers

@JT_Corrin

Would like to know more details of your data structure because I use this in a lot of my Production apps and it works fine consistently. I see no possible reason why the values would be fetched only sometimes.

Let me know and we can take a look.

Thanks,
Hardit Bhatia

Thanks, @PowerAddict 

Using the lookup column somewhere in the app did solve the problem.

 

I've documented down that workaround solution in my blog post.

http://linnzawwin.blogspot.com/2019/12/power-apps-using-common-data-services.html#collection

 

@JT_Corrin if you're still having a problem, can you try disabling the "Explicit column selection" setting?

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,437)