I want to remove duplicated values from array

I want to remove duplicated values from below array it has 12 values but 3 are unique

Pls help

O SINGAPORE - MAINT 2022-04-1215:28:46 SINGAPORE MAINTEnd Pass

O SINGAPORE - MAINT 2022-04-1215:28:46 SINGAPORE MAINTEnd Pass

© SINGAPORE - MAINT 2022-04-1215:28:46 SINGAPORE MAINT End Pass

© SINGAPORE - MAINT 2022-04-1215:28:46 SINGAPORE MAINT End Pass @ SINGAPORE - MAINT 2022-08-2208:15:20 SINGAPORE MAINT End Pass

Q SINGAPORE - MAINT 2022-08-2208:15:20 SINGAPORE MAINT End Pass

O SINGAPORE - MAINT 2022-08-2208:1520 SINGAPORE MAINT End Pass @ SINGAPORE - MAINT 2022-08-2208:15:20 SINGAPORE MAINNT End Pass

© SINGAPORE - MAINT 2023-03-2214:50.48 SINGAPORE MAINT End Pass

O SINGAPORE - MAINT 2023-03-2214:50:48 SINGAPORE MAINT End Pass

O SINGAPORE - MAINT 2023-03-2214:50:48 SINGAPORE MAINT End Pass

O SINGAPORE - MAINT 2023-03-2214:50:48 SINGAPORE MAINT End Pass

Hi @Sudheer_Kumar_S

Try this

uniqueArray = originalArray.Distinct().ToArray()

@Sudheer_Kumar_S

Make sure to import the System.Linq namespace at the beginning of your workflow to use the Distinct method.

@Sudheer_Kumar_S

If you find the solution for your question please mark as solution to close the loop.

Tried its it not Working… can you suggest any other way

Hi @Sudheer_Kumar_S

Try this

arrString.Union(arrString).ToArray

I hope it works!!

Hi @Sudheer_Kumar_S

Try this it is working

InputArray.Union(InputArray).ToArray

I have attached xaml for your refernce.

Sequence3.xaml (8.1 KB)

Regards,

Hi @Sudheer_Kumar_S

  1. Start by using the Assign activity to convert the array to a list. Let’s call the array inputArray:Variable: inputArray Value: YourArray.ToList
  2. Use the Assign activity again to apply the Distinct method to the list and store the result in a new list. Let’s call the new list distinctList:Variable: distinctList Value: inputArray.Distinct.ToList
  3. Finally, convert the distinctList back to an array using the Assign activity:Variable: distinctArray Value: distinctList.ToArray

Hope it helps!!

Hi @Sudheer_Kumar_S ,

Could you let us know what is the Expected output for the Input provided ?

It seems that the Unique Identification logic is different from the general manner, We find more than 3 Unique values when checked manually.

Let us know how the unique identifier is understood.

Hi @Sudheer_Kumar_S

Use this method it’s working:

The output is : 7

Correct output is also 7

Check one your data, I have marked the differences and its having 7 unique files.

So, the problem is not the method.

1 Like

Hi thanks for reply… it’s a copy paste error… but Values are same…

@Sudheer_Kumar_S

So did it works or not?
If not please share the file names and I will try.

I found a simple solution… I’m using arrayvar.contains(str value) then appending it to a variable… it’s working… thanks for your help

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.