Get Index Row from a DataRow, not a Datatable

Hello Everyone,
I use the Framework Template, and here in the first stage i extract DataTable from a Excel File and transform in DataRow. The problem appear when I need the Index Number from a DataRow. Without a loop. Please Help.

Hi @Ionut_Istrate

you transform DataTable into DataRow[] it’s an array of DataRows, if you want to access items in a dataRow[]
you will use the same logic of accessing items in DataTable meaning

YouDataRowArray(0)(0) will give you the first item of the first row.

Regards,
Reda Marzouk

1 Like

Thank you Reda, for your answer, but it give me the first element from Excel, and i need the index…
I send you a piece of my project to see how i am doing this.IndexExtract.zip (9.5 KB)

Do you want the index meaning the Column Number?

1 Like

No, the row number i want

Hi,
is this what you need?

IndexExtract.zip (9.6 KB)

Cheers

EDIT: To get index of particular datarow in datatable use

index = dt.Rows.IndexOf(datarow)

3 Likes

Thank you J0ska. It works, but i need to do this without a For loop, because i use the FrameWorkTemplate, where i take the DataRow from GetTransactionData and process in the Process Stage…

1 Like

Not clear…
Why do you transform DataTable into array of DataRow?
What for do you need the index?
Cheers

Thank you for your response J0ska, but from your solution i find mine. :slight_smile: I need to transform in DataRow because i work with FrameWork Template and if you rememeber i need to transform the DataTable in DataRow to take every time a row and process him, not in a loop. I hope you understand. The point is that i know now the solution. :slight_smile:

Thank you all for your responses and a good day to all! :slight_smile:

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