Morning guys, I have a collection as shown in Input collection. Primary key is email address. I want to get distinct rows from this collection in such a way that if Group Name and Is preferred member is provided in that row, it will be selected otherwise get the one with that information blank. Please see the Output collection for an example output. Any help will be greatly appreciated.
Thanks
Input Collection
Name | Group Name | Is Preferred Member | |
John Doe | John.Doe@company.com | ||
Jimmy Doe | Jimmy.Doe@company.com | Group 2 | |
Jane Doe | Jane.Doe@company.com | ||
Jimmy Doe | Jimmy.Doe@company.com | ||
Jill Doe | Jill.Doe@company.com | Group 1 | Yes |
John Doe | John.Doe@company.com | Group 3 | |
Jimmy Doe | Jimmy.Doe@company.com | Group 2 | No |
Output collection
Name | Group Name | Is Preferred Member | |
Jane Doe | Jane.Doe@company.com | ||
Jill Doe | Jill.Doe@company.com | Group 1 | Yes |
John Doe | John.Doe@company.com | Group 3 | |
Jimmy Doe | Jimmy.Doe@company.com | Group 2 | No |
You can watch this video.Also request you to please subscribe this channel.Your one click helps me a lot.
@bkk, a quick reply to get you started and we can help with specific code later if you need it. To accomplish what you want you will need to:
Hope that helps!
Thanks BCLS776, appreciate the suggestion. Let me try and get back to you.
Bkk
Here’s a simple formula to do the work for you:
//Duplicate removal code
ClearCollect(colOutputCollection,ForAll(Distinct(colInputCollection, ThisRecord),ThisRecord.Result));
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
@mdevaney Thanks. What you have quoted is what I have done, but that does bring in duplicates and hence I know that is not the answer. I have screen shots and code included.
Code on Create Collection
ClearCollect(
colInputCollection,
{
Name: "John Doe",
Email: "JohnDoe@company.com",
Group: "",
IsPRefMem: ""
},
{
Name: "Jane Doe",
Email: "JaneDoe@company.com",
Group: "",
IsPRefMem: ""
},
{
Name: "Jimmy Doe",
Email: "JimmyDoe@company.com",
Group: "Group 2",
IsPRefMem: ""
},
{
Name: "Jill Doe",
Email: "JillDoe@company.com",
Group: "",
IsPRefMem: "Yes"
},
{
Name: "John Doe",
Email: "JohnDoe@company.com",
Group: "Group 3",
IsPRefMem: ""
},
{
Name: "Jane Doe",
Email: "JaneDoe@company.com",
Group: "",
IsPRefMem: ""
},
{
Name: "Jimmy Doe",
Email: "JimmyDoe@company.com",
Group: "Group 2",
IsPRefMem: "No"
},
{
Name: "Jill Doe",
Email: "JillDoe@company.com",
Group: "Group 1",
IsPRefMem: "Yes"
}
);
Create Distinct has following code
ClearCollect(colOutputCollection, ForAll(Distinct(colInputCollection,ThisRecord),ThisRecord.Result));
Distinct
I disagree. Your example shows it worked perfectly. The only duplicate record is for Jane Doe and that gets removed.
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
You can disagree, but that is NOT the question I asked in the first place. Please read through the original question.
Thanks
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
193 | |
53 | |
51 | |
37 | |
37 |
User | Count |
---|---|
283 | |
94 | |
84 | |
77 | |
77 |