Unique Value in Number Array Using Dictionary in UiPath

In this article we will learn how to identify first unique value in Integer Array in UIPath.

Example :
[1,1,2,3,3] -2
[1,1] -Zero/No ouput

First we will take an integer array and dictionary .
" width="640" />
Initialize the dictionary using Assign activity 
dict= new Dictionary(Of Int32,Int32)

Below are implementation steps :
1)First lets iterate over the input array using for each loop activity in UiPath.
2)While iterating check the key exists in dictionary using KeyExists activity in Uipath ,which returns True if key exists else false if key doesn't exists.

3)Based on flag value like if flag is False means that key not exists in dictionary so add this value as key and 1 as value to the dictionary. Similarly if flag is True means key exists so simply get the value of key and increment that value by 1 to the existing key.

4)Later iterate over the dictionary and if value of key is 1 means that key is uniquely exist in the array.

If you have any doubts please watch below tutorial.

About author


Tech enthu, owner of kbtutorials youtube channel

Leave a Reply