Row Count of Data table

hello everyone,
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

1 Like

Hi rashmi,
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…

dt.Rows(rowidx).Item(“ColumnName”).ToString.Contains(“Keyword”)

Regards
Madhura

hey madhura,
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.

@Sheetal6289

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

Untitled1

Instead you can use

Put your column Name instead Status

Regards
Madhura

1 Like

thank u so much for ur reply madhura…
it worked n I got the result , was trying from past 8 days.
thanks a lot…

1 Like

hi - :slightly_smiling_face:
use below to get row count on data table.

“table_name”.Rows.Count()

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
image need assistance on this