I am getting the data into an excel file , afterwards with the if condition I am saving this data to to 2 different datatables. now I want to get a count of these records from these 2 tables and display the count along with some text into excel file.
I used readcsv activity for reading from csv file and with for each row activity m going through the table checking for specific condition and saving data to 2 different tables . Now I want count of both these tables so hoe can I get it, which activity to use ???
For getting the count of the datatable you can use : DataTable.Rows.Count
thanks for the reply…
also I want to search for a specific keyword in datatable rows for that m using ,
for each row…
for each item in datatable… and below this in if condition m checking items like InputDataTable.Rows.Contains(“MM”)
but this is giving me error as rows.contains gets input of a key
can u please tell me how can this be achieved.
@Sheetal6289 pease try something like…
thank for d reply.
m new to this .
can u please tell what will b my rowindex and also column name ?
my data is in “C” column. and I have to iterate through all the rows to check for the data.
Row Index is your row number inside datatable, which starts with 0
Column Name is the column header you have given in your excel file.
If you check AddHeaders property while reading excel sheet, then column names will be which you have mentioned in first row in excel sheet, otherwise they will be column0, column1 and so on…
Instead you can mention column index which also start from 0. In you case the data is in C column, so the column index will be 2
Instead you can use
Put your column Name instead Status
thank u so much for ur reply madhura…
it worked n I got the result , was trying from past 8 days.
thanks a lot…
use below to get row count on data table.
Hi madhuraj, i have a quite similar case where I have values in a data table with 15 columns , but I need to check the values only for 2 columns. In that 2 columns also I need to check if the cells if it is nothing then it should check for the next . so for example if the values would have been in the second row then the first row would have been null so it should go to the next and if it founds the values then get the values
need assistance on this
Here is an detailed article on it
# How To Count Rows In DataTable – In UiPath
I think the problem is the how DT store the values. It is the reference type.
For example , If u declare DT A and B, assign like A=B
whenever you update the data in DT A, B will be automatically updated since it is the reference type.
So make sure to get what you want , when you declare the two DTs, please declare B= A.copy
So A and B will not be same anymore if you make changes to any of them.
Hope it helps.