I want to choose a string which repeates more number of times in array or list

This is my array {“AAA”,“BBBB”,“AAA”,“CCC”,“BBBB”,“AAAA”,“BBBB”,“CCC”} I need the bot to return “BBBB” as it is repeated more than other entries. Can you help me with this?

Hi @karthikeyan.srinivasan9 ,

Could you Check with the Below Snippet Activity in Marketplace :

You would only need to Provide two Arguments

  1. in_ArrayOfElements
  2. out_MaxOccurredElement
1 Like

As an alternate we can do with LINQ:
grafik

(From x In arrValues
Group x By k=x Into grp=Group
Order By grp.Count
Select s=k).Last()

grafik

Find starter help here:
Array_GetItemWithMaxOcccurence.xaml (5.2 KB)

Also Have a look here:

2 Likes

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