Urgent help required on this - Error - There is no row at position 1

Could anyone please help me on this as it is very urgent and can’t tolerate this error.

Error Description:

Task:
Flow 1 : Reading some data fields from PDF and stored in a Datatable, passed the Datatable as a OUT argument to main flow
Main Flow - Invokes Flow 1, gets in the Datatable argument to a local Datatable variable and assigns some values to some local variables from the Datatable and process the application execution with those variables obtained.

Error Description: 90% of the time of no errors, 10% of the times getting the error as “There is no row at position 1”.

On checking the log, the error is thrown exactly when the local variables assignments from the Datatable from Flow 1 starts, But if i re-run the same file again immediately it is successful.

No idea why the error is coming up, searched for a solution in all this forum, but couldnt get any.
every time after invoking the Flow1 in the main flow i have added a log that prints the row count of that datable and it is 1.so datatable is not empty, no idea what is causing this error.
Please someone who is aware of these error help me on this.

Are you using anywhere the following expression to get the data row.

dt.Rows(dt.Rows.Count)

If data table contains only 1 row, then as per the expression you are fetching the dt.Rows(1) which is incorrect and there is no row at position 1.

The problem is that the count is 1 but the data table row index starts at 0.

Actually you have to use the following expression in order to get your workflow right.

dt.Rows(dt.Rows.Count-1)

Please check in your workflow if you are using such kind of expressions.

Regards,
Karthik Byggari

3 Likes

Hi Karthik, thank you for the response.

Actually i am using the count part just to check whether the out argument contains data in it or not, the actual issue is in the assign statement, thats where the error is thrown.
In Assign activity - LocalVariable=Datatable.Rows(row).Item(“Column1”).toString
where row=0 in this case.

And in 90% of the case this is not thrown to exception at all, but sometimes it is thrown saying that error and if i rerun the same file it is successful, no issues with input file, no issues in the code as well as that is successful 90% of the time.

Did you checked in your workflow anytime, if row = 1 but data table contains only one row. In this case the error occurs. I am not sure if that is causing the issue in your workflow.

To avoid this you can add one extra condition -

if  row < DataTable.Rows.Count  Then
//Do process