Hi All,
I m a little stuck , i want to get all the data(data of all columns) for a particular row where there is a specific value in a column.I am able to get the value of a specific cell only.
Help will be appreciated.
Thanks in advance.
Rahul.
Hi All,
I m a little stuck , i want to get all the data(data of all columns) for a particular row where there is a specific value in a column.I am able to get the value of a specific cell only.
Help will be appreciated.
Thanks in advance.
Rahul.
@Rahul_Dochak use for each row and pass the input.
inside use if condition as row(âname of the columnâ)=value
it goes to then section there you can give the write line row(0).to string+"-"row(1).tostring like you can mention to get the values of your datatable.
First, read the excel file.
You would need to use Build Data Table to create an Empty Data Table, then Use For each row activity to traverse (loop) through DataTable, then use IF activity to check specific column in a row, if that value matches your criteria then use Invoke Method activity to import the specific Row to the new DataTable that you built
Hi
âHope these steps could help you resolve this
âuse a excel application scope and pass the file path as input
ânow use a read range activity and get the output with a variable of type datatable named outdt
ânow use a for each row loop and pass the above variable
âinside the loop use a if condition like this
row(âyourcolumnnameâ).ToString.Contains(âthat specific valueâ)
if the condition passes it will go to THEN part where we can get all the column values in that row using a assign acitivity like this
out_rowitemarray = outdt.Rows.IndexOf(row).ItemArray
where out_rowitemarray is a variable of type array of strings
Cheers @Rahul_Dochak
ImportRow.zip (16.1 KB)
Here is an example
Hi Rahul_Dochak
Please follow below steps,
1.Read excel and store into data table
2.User for each row and assign data table variable
3.In for each loop use assign activity i.e variable 1=row.item(âparticular cell nameâ)
Thanks all ,I will try these and let you all know if the problem persist.
Great
Cheers @Rahul_Dochak
Hi Again @srdjan.suc,@Palaniyappan,@venkatmalla6 ,
It worked and I m able to get the data easily,but the thing is it is not optimized for a small sample it might work but if i have sample of thousands entries this will take forever,Is there a way to query it and not iterate it through.
Thanks .
Rahul
Yah sure
We can use a select method
Like this
Yourdatatable.Select(â[yourcolumnname] = âvalue to be checkedâ â)
This will give us array of datarow
Cheers @Rahul_Dochak