How to get the row index for a particular row which meet a condition

Dear all,

Good day,

Can anyone of you teach me how to get the row index for the empty value in the “STATUS” column?

i will need to filter the datatable to check for the status which is empty to get the not yet send item.

Then after that, will need to send email to notify the delivery.

After email sent, will need to update the status field to be " SENT".

Thank you.
image

Hi,

How about using For Each Row as the following?

If you want list of row index for empty , the following will work.

listInt32 = dt.AsEnumerable.Select(Function(r,i) if(String.IsNullOrEmpty(r("Status").ToString),i,-1)).Where(Function(x) x>=0).ToList

Regards,

Hi @irene0227

You can use lookup datatable activitiy to get the rowindex of empty value under Status Column

Datatable : dt1

Lookup value : “”

Lookup column : Status

Rowindex : index

The index will return the value of row which contains that row

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed:

1 Like

Check this below workflow, @irene0227
Uipath_GetRowIndex.xaml (9.5 KB)
Hope this may help you :slight_smile:

1 Like

dr = dt.AsEnumerable.SingleOrDefault(Function (x) x(4).ToString = “”)
index = dt.Rows.IndexOf(dr)

1 Like

Dear all,

Thanks for the advice and solution provided.

Really much appreciated.

1 Like

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