Find last row with condition

hello,
For Each Row excel file. I want do action after complete last row as condition. How i can do, thank you

1 Like

Hey @anh.nguyen

So you want to find the last row of that stock no. Is that correct ?

Thanks
#nK

1 Like

Yes last row of that stock no

Hi @anh.nguyen

Kindly check this out

Hope this helps

2 Likes

we can groupby the rows and refering to the last member of the group

ListLastMembers =

(from d in dtData.AsEnumerable
Group d by k=d(YourColNameOrIndex).toString.Trim into grp=Group
Select r = grp.Last()).toList

then with a for each activity over ListLastMembers we can process the rows further

1 Like

Hi @anh.nguyen !
Just to count the rows you can write Dt(DatatableName).Rows.Count
:slightly_smiling_face:

1 Like

I want check by if condition: if last row of stock No. don’t do this action ?

image

1 Like

Hey @anh.nguyen

Use Filter at the beginning & find the total row count to perform the check.

Thanks
#nK

1 Like

LastRow.xaml (8.6 KB)

This may be helpful. :slightly_smiling_face:

1 Like

maybe your requirement is about processing the groups and its members. So let us know your initial business case. Thanks

1 Like