Error : Value of type "DataRowCollection" Cannot be converted to "DataRow"

Hi All,

I’m using RE-Framework template. And using Excel sheet as input. When I’m trying to iterate the rows it is showing error as shown below.
I have given this condition in if
in_TransactionNumber <= io_dt_TransactionData.RowCount

and assigned this value to out_transaction item
io_dt_TransactionData.Rows(in_TransactionNumber-1)
image

Can someone guide me.

io_dt_TransactionData.Rows(in_TransactionNumber-1) will return a single DataRow

check this part on the missing index
grafik

1 Like

Hi @Vaishnav_Tej

Try assigning

out_TransactionItem = io_dt_TransactionData.Rows(in_TransactionNumber-1)

Hope this helps,
Best Regards.

1 Like

How to retrieve all rows one by one?

Yes I have assigned the same. And getting error as shown in the screenshot

@Vaishnav_Tej

Please delete the assign and re add the same again…

This will get each row for eqch iteration of re framework

Cheers

Hi @Vaishnav_Tej The exp should be

out_TransItem = io_dt_TransData.Rows(in_TransactionNumber)

Let’s say in_TransactionNumber is set to 0. Then the above exp gets first row from the data table

Note: Make sure the in_TransactionNumber is set to 0

How to retrieve each cell value from the data row variable

In the Process Transaction, you should able to access TransItem variable from which you can get the cell value of each row. The exp should be

in_TransItem(0) gives first cell value
in_TransItem(2) gives second cell value from that row
.....

At the end of the Process Transaction, you can increment in_TransactionNumber and loops back to the GetTransactionData and the steps repeats

1 Like