Overview
This article will show how to remove duplicates from a table using Okta Workflows.
Solution
The following table exists, and duplicate department name entries need to be removed: Workflows table.
The table looks like this after removing duplicate entries:
The solution has two flows:
- Remove Duplicates flow
- Create Row flow (helper)
Remove Duplicates Flow
The Remove Duplicates flow saves all table records into a list and removes duplicates from that list.
Remove Duplicates flow.
The flow has the following steps:
Table – Search Rows
In this step, the Search Rows card returns all the rows from a table in a JSON format that looks like this:
[
{
"Department Name": "Marketing"
},
{
"Department Name": "Sales"
},
{
"Department Name": "Engineering"
},
{
"Department Name": "HR"
},
{
"Department Name": "Marketing"
},
{
"Department Name": "Engineering"
},
{
"Department Name": "Engineering"
},
{
"Department Name": "Design"
},
{
"Department Name": "QA"
}
]
List – Pluck
In this step, the Pluck card produces a list only with the Department Name key. The list looks like this
[
"Marketing",
"Sales",
"Engineering",
"HR",
"Marketing",
"Engineering",
"Engineering",
"Design",
"QA"
]
List – Remove Duplicates
In this step, the card removes duplicates from a list. The result is a list without duplicates
[
"Marketing",
"Sales",
"Engineering",
"HR",
"Design",
"QA"
]
Tables – Clear Table
In this step, the flow clears the table before saving the list without duplicates into a table.
List – For Each
This step calls for a helper flow to save the list without duplicates in a table.
Create Row Flow
The Create Row flow creates a new row in a table for each item in the list.
Create Row flow.
Table Without Duplicates
The result is a table without duplicate values:
Workflows table without duplicates.
Related References
- How to Setup a Workflows Helper Flow (With For-Each and Streaming Cards)
- How to Delete Multiple Table Rows in Workflows
- How to Iterate Over Rows in a Table in Okta Workflows
