Adding a new column to that datatable in the form of (Y/N), Add data column
Using for each row i then assign Lists for each column
Then Add to collection for each of the list created
Then use For Each (Item in col1List)
Then an if statement with condition col2List(0) = “2”
And here is my question.
when the statement is true i am wanting to write “Yes” in the column i have created and when false “No” given that specific record. It is not working with the current method is have and was hopping to get a solution to this problem as i can not find any resources on this.
i have a small doubt here
in for each we have mentioned as col1List
and in the IF condition we have mentioned as col2List
and inside the THEN and ELSE part we have y_nolist
may i know where these list variables are used as you said you have only one list variable
Cheers @Rowley101
colList1 is used primary key
colist2 is the values of the column in the list
y_nolist is the list of initially null values from the column i have created using add data column
@Rowley101 If I understand it correctly, you are looping through a datatable and inside which you are checking a list for values.
First question what this list contains?
Secondly, You are looping through colList1 and checking the condition in colList2. what is the relationship between these two lists
Is it possible to share the workflow with annotations.
You can use add data row to add a row of data to your columns all you need to do is fill the input were datatable is the datatable you want to add info to and array row the array of info you’re adding. For example: {variable1,variable2}. Variable1 will be assign to the first column and variable2 to the second column. As well you can put there for example a string, just remember that the info must be of the same type as your column type. sample: {“yes”, variable1} you this activity in the if true and if yes and add the different values. if true then {“yes”, variable1} else {“No”,variable1}.
@Rowley101 Output wise your approach will work as you are expecting. But as per standards and process improvisation, below are some of the points that i would like to highlight-
Multiple loops - You have declared two for loops. One for data table (Loop1) and other for list collection (Loop2). You are instantiating the list every time you fall into the Loop1 and adding the column value into the collection. This means, for every row there will be only one item in each of the list collections. Hence Loop2 is not required here. Even you are looping through Loop2 but not utilizing the loop value. i.e., item. Instead directly accessing loop for the 0th item.
List collections - You are instantiating list collections for every row item which comes with the cost of memory and space. Additionally, the you are assigning values from row to list collection but some of these collections are not used anywhere in your workflow. The one list collection you are using is to check the value, which can be achieved by directly checking the column value in the row as well. This will reduce lines of code as well as processing time.
Accessing Columns - You have used column indexes to access the columns. But in real scenarios sometime the columns might not be in the same order that you are expecting. Hence its preferred to refer column names instead of column indexes.
I am fairly new to RPA and currently doing my first project at work on it so the more i know the better.
That was mainly a scenario as i am currently working on a process much bigger at work.
as for the points:
I have Amended the double loop and just put it within a single one, i.e. the for each row
i have, in the robot i am working on at work needs all lists collections instantiating so it was more of a practice thing.
The data i will be receiving will remain in the same format everytime so i have no need to change the indexes.