Hi - I could use some help on my automation project.
I have a website that contains a data table (See screenshot below) and I have an excel file that has the same account numbers / names & also contains a value for each account (there are some accounts that have no value and are left blank). I want to look at the data table from the website and using the account number, check to see if the excel file has a value for a given account. If so, I want to write that account number in the empty “value” cell in the website.
1.Use the use browser/application activity.
2.Within that activity use the extract data table activity and extract the data from the website.
3.Read the entire excel using the read range activity.
4.Use the for each row in data table and pass the variable that stored the data of the extracted data from website.
5.Within for each row in data table use another for each row in data table and pass the variable that stored the data of excel.
6.Within second for each row in data table activity use the if condition and the syntax must be like CurrentRow(Account).Tostring.Trim.Equals(CurrentRow1(Account).Tostring.Trim.) and if the condition gets satisficed then it enters the then sequence of if condition.
7.Wthin the then sequence use the TypeInto activity and indicate the place where you want to write the value.
8.In TypeInto activity pass the syntax as CurrentRow1("Value").ToString.Trim and after this TypeInto activity use the break activity so that it reduces the execution time.
Note : In above mentioned process CurrentRow is the row of first for each row in data table activity and the CurrentRow1 is the row of second for each row in data table activity.
=> Take the Use excel file activity and pass the input excel file path.
=> Extract the datatable in the application as datatable by using the extract datatable activity. Output - extracted_dt (Datatable datatype)
=> Use for each row in datatable activity to iterate the extracted_dt rows. Output - CurrentRow1
=> Inside for each row in datatable activity insert the for each excel row to iterate the each row in excel. Output - CurrentRow2
=> Inside for each excel row activity insert the If condition, write the below condition
-> CurrentRow1("Account").toString.equals(CurrentRow2("Account").toString) and CurrenRow1("Description").toString.equals(CurrentRow2("Description").toString)
=> Inside If condition place assign activity and create a variable called value String (datatype). Store the value in excel file in this variable.
→ value = CurrentRow2(“Value”).toString (The value which is in excel file.)
=> After assign Insert the type into activity and indicate the value field in the webpage.
=> When indicating the element check the strict selectors and uncheck the fuzzy selector and image and validate.
=> Open the properties of strict selectors and select a attribute which is specific and pass the value variable to that attribute in Ui explorer and validate.
Thank you for the help on this so far - I am running into an issue where in the IF statement I’m getting error code BC30690: Structure “Integer” cannot be indexed because it has no default property. I have my CurrentRow1 and CurrentRow2 currently being stored as Int32 variables. Does this need to change?
Also as an FYI I don’t need to match the descriptions so I removed those from the above formula.
Do I set that as a variable after the “For Each Row in Data Table” ? My output on the For Each Row in set at CurrentRow1 & CurrentRow2 but I’m not sure where you would put that function to convert.
No don’t need to create a int variables. Delete those variables first.
There are two for each loops rights we have changed CurrentRow in first for each as CurrentRow1 as for second for each we have changed to CurrentRow2 for clarification.