Read Datatable index 1 and index 2

Hi Team,

I fetched the data from database and stored in Datable Named Output variable.

I need to read Grand Total and Sum_Invoice_TA as shown in picture.

I used: Output.Rows(1)(“Grand_Total”).toString=Output.Rows(2)(“SUM_Invoice_TA”).toString
It gives me error there is no row at position 1 .

can anyone please help. Thanks in advance

Hi @ch460960

Could you try this instead?

Output.Rows(0)(“Grand_Total”).toString=Output.Rows(0)(“SUM_Invoice_TA”).toString

Kind Regards,
Ashwin A.K

1 Like

Thanks it works :slight_smile:

1 Like

row indexes are 0 based.

we do understand that from 2nd row a value has to be assigned to a first row

Output.Rows(0)(“Grand_Total”).toString=Output.Rows(1)(“SUM_Invoice_TA”).toString

But when exception is about no row on position then you will have maybe only 1 or 0 row. So just inpoect the datatable e.g while debugging

in case of only 1 row is present then refer to Ashwins post from above

1 Like

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