How to get previous row value

Sample input data attached here.

If current row value is empty
example : In second row Branch, subject, Semester values are empty. In that scenario i need to pick Branch, subject, Semester values from previous row. How to achieve this?

Hello @balanirmalkumar.s

In your For Each Row in Data Table you should extract rowindex from the properties.
Then you could extract values from the row prior to the current, by indicating rowindex minus 1.

Example:

dt_Datatable(int_RowIndex-1)("ValueToExtract").ToString

You could do a For Each dt_Datatable.Columns to iterate the individual columns for values.

Take a look at this example:
Extract prev row values.xaml (13.5 KB)

Regards
Soren

Hi @balanirmalkumar.s

You can apply the solution like below:

CurrentRow.Item(“Branch”) = dtInput.Rows(rowIndex-1).Item(“Branch”).ToString

Make sure that you create a variable for Index of ‘For Each Row in Data Table’ activity called ‘rowIndex’

Regards.