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

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?

12 REPLIES 12

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

SweetMaddin
Helper I
Helper I

Running in the same problem.

ClearCollect(SearchMonthDates,ShowColumns(AllMonthDates,"January"))

This simple example, used in many Posts here as "Function" is still NOT function and a BUG.
In my case the Collection SearchMonthDates is created BUT no Data is inside.
When using the development environment the correct result is confirmed, but in the App not running.

I saw the bug exist already since over one year, sadly and poor behaviour ...

@SweetMaddin  Is the value from "January" column referenced anywhere in your app? It is by design in Power Apps canvas app to retrieve the value which is used in the app.

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

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (12,004)