Find last Find First/Last Data Row activity

Hi Team,

I am using the Find First/Last Data Row activity however it stopped and the error the A0 doesn’t exist then I used if = 0 inside it I used assign to make the previous zero 2 however when I have just one row the BOT start writing the third row leaving the headers and the second row if I used 1 instead of 2 it write on the header

Hi @omar_ismail

If YourDataTable.Rows.Count = 0
Then
rowToWrite = YourDataTable.NewRow()
Else
’ Use Find First/Last Data Row activity here to get the last data row.
’ Assign the result to the rowToWrite variable.

YourDataTable.Rows.Add(rowToWrite)

Hope this helps

@omar_ismail

If you want to get first row and last row you can try this

To get the first row

dt.AsEnumerable.First

to get last row

dt.AsEnumerable.Last

you mean instead of using the Find First/Last Data Row activity?

@omar_ismail

Yes

It will give you the first row and last row

Just use assign activity

Its datatype is datarow

@omar_ismail

Its datatype is of system.data.datarow

And before to that use if activity

Condition as

dt.rows.count>0

In then block use this assign activities