Adding data to a datatable in a specific column

0 votes

Hello all, My process is

  1. reading the data from a txt file, read CSV
  2. converting it to a data table,
  3. Adding a new column to that datatable in the form of (Y/N), Add data column
  4. Using for each row i then assign Lists for each column
  5. Then Add to collection for each of the list created
  6. Then use For Each (Item in col1List)
  7. 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 and was hopping to get a solution to this problem as I can not find any resources on this.

Here is my for Each Body so far:


Oct 24, 2019 in RPA by anonymous
• 3,690 points

1 answer to this question.

0 votes

Hi there, result 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. Please consider these points and you can modify your workflow:

  1. 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.

  2. 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.

  3. 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.

Hope this will help you!

answered Oct 24, 2019 by Anvi
• 14,150 points

Related Questions In RPA

0 votes
0 answers

HOW to extract a column data and save it in the new sheet using UIPATH

Sep 12, 2019 in RPA by anonymous
• 120 points
0 votes
2 answers

change a specific column of an excel sheet in UiPath

1. First of all , you need ...READ MORE

answered May 16, 2019 in RPA by Venkat
• 320 points
0 votes
1 answer

How to assign a data in a variable in to excel file?

System -> File -> Workbook -> Append ...READ MORE

answered May 22, 2018 in RPA by wrecker
• 3,110 points
0 votes
4 answers

How to find the sum of 2 columns of an excel and display it in a 3rd column using UIPATH?

These are the steps to add two ...READ MORE

answered Aug 2, 2019 in RPA by Shivi Singhal
0 votes
1 answer

What is Get Jobs activity used for in UiPath Studio?

Hey @Rakesh, Get Jobs Activity can be ...READ MORE

answered Mar 14, 2019 in RPA by Abha
• 28,140 points
0 votes
1 answer

How to format text in notepad using UiPath?

Hey @Rashmi, if you want to automate ...READ MORE

answered Mar 18, 2019 in RPA by Anvi
• 14,150 points
+2 votes
1 answer

How can I display current date in "dd-MMM-yy" format in UiPath Studio?

Hi Shilpa, if you want to display ...READ MORE

answered Mar 18, 2019 in RPA by Pratibha
• 3,690 points
0 votes
1 answer

What is Flow Decision used for in UiPath studio?

Hi Smita, Flow Decision activity is a ...READ MORE

answered Mar 19, 2019 in RPA by Pratibha
• 3,690 points
0 votes
1 answer

How to check if a string exists in datatable using UiPath?

Hi @Ravi, to check whether a string ...READ MORE

answered Mar 19, 2019 in RPA by Anvi
• 14,150 points
+1 vote
2 answers

Looping through PDF files to extract specific data using Uipath

Hi Rashi, you can access all the ...READ MORE

answered Mar 5, 2019 in RPA by Anvi
• 14,150 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP