Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

Combine two SharePoint lists into a single collection

I actually got this to work, but I feel dirty and I think I am doing something really wrong. Here is the scenario. I have two SharePoint lists. 


Doggo Data - contains meta data about the doggos such as name, owner, breed, etc. 

Doggo Media - contains all the pics for the Doggos in 'Doggo Data' including a flag if this should be the profile picture. The 'Doggo ID' is a number field which corresponds to the associated dog in 'Doggo Data'


I have a gallery component that takes a collection of all the dog metadata plus a profile picture so I need to combine 'Doggo Data' with 'Doggo Media' and pass this into my component. Also if there isn't a profile, just use a stock image.


Here is what I got:



//try to get AllDoggos in the format needed for the gallery component
ClearCollect(AllDoggos,{ID: -1, Doggo: "Doggo Name", Hooman: "Hooman", Breed: "Breed", Description: "Descriptiption", 'Profile Picture':User().Image}); //create the columns and column types

Clear(AllDoggos); //remove template data

ForAll('Doggo Data', //loop through all dogs in the Doggo Data SharePoint list
    Collect(CurrentID, {ID: ID}); //a hack to store the current ID in a temp variable
Patch(AllDoggos, Defaults('Doggo Data'),{ID: ID, Doggo: Doggo, Hooman: Hooman, Breed: Breed, Description: Description, 'Profile Picture':Coalesce(First(Filter('Doggo Media', 'Doggo ID' = First(CurrentID).ID,'Is Profile Picture' = true)).Media,default_doggo)}); 

    RemoveIf(CurrentID,true); //remove the current ID so you can reset it on the next iteration




I had to do that hack to store the current ID, because previously I was trying to do a filter from inside the ForAll like this


Filter('Doggo Media', 'Doggo ID' = ID


But it never returned anything. I think ID was not getting passed into the Filter statement. 


So is there a better way to do this?

Super User III
Super User III

Filter('Doggo Media', ID='Doggo ID',ColumnToReturm)

Helpful resources

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!


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 (19,622)