How to get random username to fill from txt file

Hi. I have 1 txt file with thousands of username. So how i do to get random username to fill form. Thank so much.

HI @lehunglam,
In text file how it will look like the usernames.

If the username present like one by one use below code
arrvalue= strvalue.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)
else if you have the value with comma superated
arrvalue= strvalue.Split(","c, StringSplitOptions.RemoveEmptyEntries)

username= Convert.Tostring(arr1[random.Next(arrvalue.Length)])

Regards,
Arivu

1 Like

Thank so much @arivu96, i will try.

Hi @lehunglam,

you need to create one Random variable->randomvar

randomvar= new Random()

intrandom=Convert.Toint32(randomvar.Next(arr1.length))

username =Convert.Tostring(arr1(intrandom))

1 Like

Hi @arivu96, I am new in Uipath, i can’t understand how to do, this is a shame.
Could you please upload a example for me ?
The username file present one by one
Thanks you so much

HI @lehunglam,

refer the below example

Main.xaml (13.1 KB)

text file look like
arivu
anbu
malai
akila
archana
sri
lalitha
chand
bala
arun
raja
karthick

Regards,
Arivu

2 Likes

That’s very nice, it work well, thank @arivu96 once again.