How to convert data variable get from "for each ui element" into datatable for database insertion?

Hi guys, I wanted to get a list of data from a website and store them into database, how to convert data variable get from “for each ui element” into datatable for database insertion?

HI,

There are some ways to achieve it. As one of them, we can use AddDataRow activity as the following, for example.

Regards,

Hi Yoichi, what if I have multiple element? How can I store them into datatable?

image

Have this error as well

image

Hi,

image

I guess we can use auto-generated variable such as Address or similar name variable for example.Then we can set it as {Address, BuildingType, ...} at ArrayRow in AddDataRow.

For now, can you check if you can use the above variable in ForEachUIElement activity?

Regards,

I will have this error, If set in { }

Hi,

For now, can you check type of these variable?

OR

Can you try to add .ToString like {SpaDate.ToString,Address.ToString}, then check its content ?

Regards,

Alright thanks

Will have error at runtime, may I know what’s the issue?

HI,

Did you create DTAdd in advance? It’s also necessary to define column.

Regards,

Yes I defined DTAdd as arguement already, for column is it correct I defined like this?

I still have the same error after doing these, what should I put for the DataRow?

Hi,

Can you share screenshot of Locals panel when error occurs?

Regards,

Hi,

Here’s the screenshoot thank you
image

Hi,

I’d like to check Locals panel.

Regards,

Ops Sorry I didnt know this is the corret Locals panel.

Hi,

This shows DTAdd is null. Can you check if DTAdd is set as output of BuildDataTable?

Regards,

Thanks Yoichi, sorry I didn’t know I have to add DTAdd to the BuildDataTable.

I have encountered another error with the insertion of data to the database, can you help me look into it please? I don’t know why it show “No database selected” error, I am using the same database connection “RPAconn” it works for reading data from the database but it does not work with the insertion of data.

Here’s my table in my SQL work bench

HI,

I think it’s necessary to add DataBase name like “rpa_test.” to the table name at Table name property.

"rpa_test.mt_properry........

Regards,

Ohh okay, I was referring to a Youtube Video, I thought the table name is enough.

May I know how can I change the SQL syntax in UI path?
image

This is my DTAdd, I wonder why there is Red line

Can someone guide me on this?

I found the alternative solution by using Run Command or Run Query instead. The insert activity just doesn’t work for me

1 Like

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