Hi all- I'm at my wit's end here. I have looked through dozens of similar posts to follow examples of how to get two collections (or even 2 sharepoint lists) combined into a single collection. The two collections I am working with are called:
DirectoryData and
ProfileData
I am trying to combine into a single collection called DeepSearchData whereby the collections are matched by an email address stored in each collection as a column:
FCDUserEmail is the column in DirectoryData and
FCDProfileEmail is the column in ProfileData that I am matching the data sets by.
Can anyone help me with the syntax for this operation?
Solved! Go to Solution.
Assuming I start with two Collections (DirectoryData and ProfileData), I can merge them into a single table and match up entries similar to the following:
ClearCollect(DirectoryData,Table({FirstName:"John",FCDUserEmail:"test@test.tst"},{FirstName:"Bob",FCDUserEmail:"test2@test.tst"})); ClearCollect(ProfileData,{LastName:"Smith",FCDProfileEmail:"test@test.tst"});
ClearCollect(mergedData,AddColumns(DirectoryData,"LastName",LookUp(ProfileData,FCDUserEmail=FCDProfileEmail,LastName)))
The third line creates a new Collection called mergedData, populates it w/ the contents of DirectoryData + a new column that is a LookUp from ProfileData where the values between your two email columns FCDUserEmail and FCDProfileEmail match.
Hi @Anonymous
Is the relationship between the datasources a one-to-one or a one-to-many?
Assuming I start with two Collections (DirectoryData and ProfileData), I can merge them into a single table and match up entries similar to the following:
ClearCollect(DirectoryData,Table({FirstName:"John",FCDUserEmail:"test@test.tst"},{FirstName:"Bob",FCDUserEmail:"test2@test.tst"})); ClearCollect(ProfileData,{LastName:"Smith",FCDProfileEmail:"test@test.tst"});
ClearCollect(mergedData,AddColumns(DirectoryData,"LastName",LookUp(ProfileData,FCDUserEmail=FCDProfileEmail,LastName)))
The third line creates a new Collection called mergedData, populates it w/ the contents of DirectoryData + a new column that is a LookUp from ProfileData where the values between your two email columns FCDUserEmail and FCDProfileEmail match.
Thank you, that worked!
It's one to one. I guess I may have jumped the gun when I said it worked. Is there a way to merge ALL the columns from both datasets based on the matching email column?
It's one to one. I guess I may have jumped the gun when I said it worked. Is there a way to merge ALL the columns from both datasets based on the matching email column?
Now ask me how to do this if the two "lookup" columns were identically named.
HINT: Try the RenameColumns() function on your LookUp table input.
Yes. It's just adding some additional items to the LookUp. The first item you add to the mergedList adds ALL COLUMNS from that table. The LookUp then can add all of the columns from the secondary table. You'd need to list them out though. Let me pull up the LookUp function to make sure I've got the formatting correct and I'll post a followup.
Yeah, it does get a little hairy w/ this as the solution. It really depends on the use case of if this is a good way to handle it. So if we stick w/ what I provided, then you pick the largest of the two Tables/Collections per field count and do that first (List1 in the example below). Then add on each additional field manually into the list similarly to the blue text below.
This could get nasty fast, but there isn't a simple JOIN function within PowerApps (to my knowledge). Kinda where maybe a SQL View or similar is a better solution to do outside of the application.
User | Count |
---|---|
261 | |
128 | |
99 | |
48 | |
47 |