Assistance with Assign, create data table, write range workbook

I apologize if I am posting in on a wrong section. I have an EXCEL file, which I loop through to write the data from the excel file, to desktop application. After all the data fields on the application are populated, I SAVE and create a NEW RECORD(once you create a new record, the data is different form the previous one). I am trying to create a datatable such that I need to write in it just 3 fields from the desktop application, and export/save/write that datatable into an excel file, before it continues to the new record. So, enter all the info, write the three fields that I need into a datatable, write that datatable to excel and continue to a the new record, and repeat thousands of times. Or if you have any other/different suggestions, I am listening. This is what I have…

hi @rezart_mersini

WHy are you assigning the same variable inside the multiple assign?
LHS and RHS looks same.

Why are you assigning Asset to Asset, DESCRIPTION to DESCRIPTION, etc? That’s pointless. You already have the values in the variables.

Otherwise you’re doing it correctly.

If you’re trying to get data from the screen, you’d use Get Text for that. Three Get Text activities with output to the Asset, DESCRIPTION, and LOCATION variables. FYI the variables don’t have to be identical to the datatable column names. There’s no relation between the two.

1 Like

@rezart_mersini

  1. Writing you can do it at once after the loop
  2. Move the build also before the loop so that datatable is created and data gets added as rows into table and at the end we can write

cheers

1 Like

@rezart_mersini
Another approach :

  1. Read Range Activity : Read your input excel and store it in Datatable var.
  2. Build DataTable : Create new datatable with columns for the three fields you want to capture.
  3. For each row activity :
  • Activities to input data into the desktop application fields for the current record.
    -Extract the values of the three fields from the desktop application.
    -Add Data Row activity: Add the three values as a new row to dtOutput.
  1. Write Range activity : Write dtOutput to an Excel file.

HAPPY AUTOMATION!!

1 Like

@Anil_G hanks for the suggestion…this is what I have now…It seems to be working, but…the LOCATION field that I need to GET from the application and added to the datatable and eventually to excel, i snot being populated. The other two fields are being grabbed (ASSET AND DESCRIPTION) and are in the excel file, but not LOCATION I moved the DATA TABLE outside of the loop, as it was suggested by @Anil_G…so any ideas as to why LOCATION is not being populated in the excel file?

thanks for the suggestion. see my reply to @postwick

I think I have it somewhat like this…thanks for the assistance. But I will double check…just in case.

1 Like

@rezart_mersini

you a log message and check if location data is retreived or not

cheers

1 Like

Thanks, i should have known that…I used the log message, and I think I fixed the error…now, I changed the name of the variable Asset to ASSET(not sure if that makes any difference) but now I am getting a different error message. Not sure why it says ASSET column not part of the data table when it clearly is.

thanks for FYI…good to know that they the column names can be any name and not necessarily the same as the variables.

@rezart_mersini

Is there any space or so…

Or are you usign a different table?

You can open locals panel and check the names

Cheers

Fixed…there was an issue with my application. Everyone, thanks for all the help, much appreciated.

1 Like