Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

Removing duplicates in Dataverse through Union

Posted on by
I am trying to make a power automate workflow that goes through a Dataverse table called "Visa Status". in this table, i have Student ID and Visa Update Date columns. i want the automate flow to check if Student ID and Visa Update Date are the same, then consider them duplicate and remove. Currently, the approach I am trying is:

1. Initialize Variables:
- Initialize 'Records' array variable (Type: Array)
- Initialize 'DuplicateRecords' array variable (Type: Array)
- Initialize 'currentKey' variable (Type: String)

2. Get Records:
List rows from Visa Status table

3. Apply to Each (Process all records):
For each row in Visa Status table
{
// Update currentKey variable with combined values
Set Variable: currentKey = concat(row['crdcb_StudentID'], row['crdcb_VisaUpdateDate'])

// Check if combination exists in Records array
Condition: if contains(variables('Records'), variables('currentKey'))
{
Yes:
{
// Add to duplicates array
Append to Array: DuplicateRecords
Add row ID to remove later
}
No:
{
// Add to processed records
Append to Array: Records
Add variables('currentKey')
}
}
}

4. Remove Duplicates:
Apply to Each (DuplicateRecords)
{
// Delete row from Dataverse
Delete row
Table: Visa Status
Row ID: current item
}

However, i keep facing errors. Is there a simpler approach for this?
  • Suggested answer
    takolota1 Profile Picture
    takolota1 4,750 on at
    Removing duplicates in Dataverse through Union
    You can also use this template to efficiently find & remove duplicates https://community.powerplatform.com/galleries/gallery-posts/?postid=ad474d7b-9cf5-492c-97c4-0a68d3597aad
  • Suggested answer
    CA1105 Profile Picture
    CA1105 222 on at
    Removing duplicates in Dataverse through Union
     In your apply to each action you can add condition action and then both the conditions like Student_ID= row['crdcb_StudentID'] and VisaUpdateDate=row['crdcb_VisaUpdateDate']. If true Delete row.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,297

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,890

Leaderboard