Fetch data from datatable without loop

I am trying to fetch data from datatable but the process is outside of the loop. How can I get the data from data table without using loop. Thank you.

Hi @Lin_Myat,

Try the below code, but you have to give the row index number. The below code will take the first row of data table

1 Like

Hi @aanandsanraj

It doesn’t work. When I reach there, the process is end.

Did you get any error?
Just put the code into log message and check the output result.

1 Like

I put your code in a message box but it doesn’t show any error and log. Just end directly.

Does datatable have value?

I have a data table totalInputRowDT and I need to make a condition that datatable have value or not but the problem is the condition is outside of the loop. Thank you for your respond.

Yes, but the main process is I have to check that datatable have value or not

for just checking is there are data or not
it will give you rows count

1 Like

It is work but my check range is A6:H12 but there is data in A13. So If I take row count, the data from A13 is noted as 1. Sorry I can’t show the progress because of it is company project. Is there any other way to check?


to do the same you can directly put IsNothing(DT) in if condtion.
And if you want to get data from particular cell then,

value = DT.Rows(Rowindex)(ColumnIndex).ToString

e.g. DT.Rows(3)(3).ToString —> will hold value of cell D4


Try another way to get the value of cell use “Get Row Item” activity like below

1 Like

we can check with two possibilities like
–either use GET ROW ITEM activity where mention the datarow property totalInputRowDT.Rows(12) and in the datatable mention as totalInputRowDT and in column index mention as 0 and get the value with a variable of type string named str_output


we can use a ASSIGN activity like this
str_output = totalInputRowDT.Rows(12)(0).tostring

once after getting the value with the variable str_output use a IF condition like this to check whether it has value in it or not
NOT String.IsNullOrEmpty(str_output.ToString)
if true it means it has value so goes for THEN part or goes to ELSE part

Cheers @Lin_Myat

1 Like

It work. Thank you so much all for your respond.

I get the result instead of using column index. Thank you for your respond.

Great, glad to help. :wink:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.