For each row type into

Hi guys:)

I imported a data table from my excel that looks like this:

Name . City Job
Josephine London . Private Equity
Jan Amsterdam Baker
Sophie Barcelona Real Estate

I want to get the row (so e.g Josephine London Private Equity, Jan Amsterdam Baker, Sophie Barcelona Real Estate) and type this into for example google use get text to get the result and then delete the input and do it again for the next row I now used excel application scope and read range to create the data table and then I used for each row and type into but when i run it it says that the value of the system.data.datarow cannot be converted to string.

Can anyone help me?:slight_smile: Thank you!

1 Like

Hi @Lotte123,

If the whole text is in a single row like the below with a column name -“Addr”

Name . City Job
Josephine London . Private Equity
Jan Amsterdam Baker
Sophie Barcelona Real Estate

Then

row(“Addr”).ToString.Split(Environment.NewLine.ToCharArray())

will give an array, use that to further loop and carry out the intended activity

1 Like

Hi
Welcome to uipath community

I got the error. You were almost done
I hope you would have mentioned as row.ToString

We need to mention the column name or column index along with that Datarow

Like this
row(“yourcolumnname”).ToString
Or
row(columnindex).ToString
Where column index starts from 0 for first column in excel

Cheers @Lotte123

2 Likes

Thankyou so much for your quick response:) I just started working with Uipath so i’m not really used to it yet.

But i’m doing something wrong because it’s not working , i used assign to convert the columns into strings (i put a ll the columnnames into the variable) and then i’m trying to fill these in in google like this:


after this i want to have another type into function that types the first row in it

Hi @Lotte123,

I understand that you have a DT with header: Name, City and Job

I am not sure what are you trying to assign to your string variable strvariable, but this is an example. Maybe if you show what error is happening, it will clarify more what is wrong.

row("City").ToString +" "+ row("Job").ToString

You don’t need to do a previous Click activity, Type Into activity incorporates that option in its properties ClickBeforeTyping

2 Likes

Thank you!! I assigned strvariable = row(“Name”).ToString +" "+ row(“City”).ToString + " "+ row(“Job”).ToString.
Now I want it to get the first row (so Josephine London Private Equity) and type that into the google bar , and get the name (so use get text?) of the first result and let it delete this row and put in the second row of the data table (Jan Amsterdam Baker) and get the first name of that result and so on… so for all the rows in the data table:) and store the values of the get text in a new data table or excel sheet e.g. How do i get that loop?

1 Like

Check this workflow. I am not sure if it is exactly what you are looking for.

Demo.xaml (13.1 KB)

1 Like

Hi
Hope these steps would help you resolve this
—use a excel application scope and pass the file path of excel as input and inside the scope use a READ RANGE activity and get the output with a variable of type datatable named dt
—now use a BUILD DATATABLE activity and create a column named Name of type string and get the output with a variable of type datatable named Finaldt
—then use a FOR EACH ROW activity and pass the variable dt as input
—inside the loop as a first activity use a OPEN BROWSER activity and mention the url of the web page you want
—inside that container use a assign activity like this
strvariable = row(“Name”).ToString +" "+ row(“City”).ToString + " "+ row(“Job”).ToString

—now we can type this strvariable inside the browser with TYPE INTO activity
—this will give us the name which we can obtain using Get Text activity With a variable named str_text

—now next to this GET TEXT activity use a ADD DATAROW activity and mention the input as {str_text} in ArrayRow property and in datatable mention as Finaldt

This will add all the obtained text value from get text to a datatable named Finaldt, for each iteration of FOR EACH ROW loop

—next to this FOR EACH ROW loop we can use a WRITE RANGE activity and mention the Finaldt as input

Cheers @Lotte123

1 Like

Thanks again!!! I think I’m almost there, but when i run the script it opens google and types in the first two rows perfect after each other but then it stops and these errors appear:


and after the type into activity (with the strvariable as text) I used a get text activity with output value str_text variable and i indicated on the screen which part of the screen it needed to get and then it gives me an error which says: Cannot find the UI element corresponding to this sector.

Do you know what the problem is here? Thanks again!

1 Like

Fine
Kindly try with IE Browser instead of chrome
We can change that even in OPEN BROWSER property panel

Cheers @Lotte123

1 Like

I’m not opening it with chrome but with edge! When opening with IE Browser it gives the same error immediately and types in the first row really weird

Kindly ensure that the web page is added to Trusted Sites in IE settings
And also with these settings as well

Cheers @Lotte123

1 Like

Thank you! It’s working now, it is opening all the browsers and puts the rows in it one by one :+1: It only does not press enter so it is not going to the next screen where I should get the text from (e.g i put the names in the google bar but enter is not pressed) How can I fix that?

Did we try with CLICK activity to click on enter key
Where enable simulate click property

Or
along with the string in TYPE INTO activity we can pass the key like this
“Your string”+”[k(enter)]”
But while mentioning like this disable Simulate type Property and enable Sendwindowmessage property

Cheers @cmolina

1 Like

Oh perfect!!! Thank you so much! One last thing i’m dealing with and then it should work:). After it opens the browsers succesfully and fills in the right row and clicks on the search button, I have to get the result with the Get Text Activity but I have to click on the screen which result I need but the result changes off course for each row (it is in the same position but different text). So for the first row it runs everything perfectly but then for the second row it gives an error at the Get Text activity which states that it cannot find the UI element corresponding to this selector. Should I use a different activity ? or is it possible to use this in the For Each Row activity?
Thanks for all the help!

we got two choices, either we can change the dynamic part of selector value with wildcard like
aaname = ‘*’ so that it can accept any value in that position

or

we can use SCREEN SCRAPPING method from design tab with OCR text option chosen so that it will get the text with OCR method

Cheers @Lotte123

1 Like

Hi, i’m encountering a problem again, everything was working really good but sometimes I had some issues with the browser so I installed the extension package and now, it goes perfectly only with get text it only gets the text from the first row , so for the first row it opens the browser types the values in, gets the result, it opens the next browser types in the value of the second row and then again gets the results of the first browser/row and the same with the other rows so in my get text output variable i got the first result 3 times. I changed the selector to * but does anyone know why this is not working? Thank you!

because previous browser or tab is still opened!
so evrytime close it and try
@Lotte123 cheers

Thank you it works again!!!

Np
Cheers @Lotte123