How to find Last empty row of specific column and get the respective row value of specified column

How to find Last empty row of specific column i.e.,(FirstName) and get the respective row value(as 104) of specified column (as empId)
please find attachment for reference

did you try as the last thread @supermanPunch

suggested

DT.AsEnumerable.Where(Function(x) String.IsNullOrWhiteSpace(x("FirstName").ToString)).Last.Item("EmpId").ToString

removed from previous query

try this

Regards

@LAKSHMI_NARAYANA_PEMMASAN I tried, but earlier my DT as different, it has empty rows at the end. now it was reverse data table where empty rows has at the begening. when im trying with this expression it is giving 105 as result i need 104 value.?

that is the reason i have removed the not from query

basically it should give you 104 only

let me check

Regards

@LAKSHMI_NARAYANA_PEMMASAN i tried earlier but its showing result as empty

i have tested this is giving right value only

check once again

image

image
result is 334

Regards

can you give the screen shot of the assign activity with the result

and check in locals panel

Regards

@LAKSHMI_NARAYANA_PEMMASAN I have edited the Excel data could you please try for that. and let me know if it was giving the correct result.

did not get you , do you want me to try on your excel sheet than

please attach the file then i can try on that as well

Regards

Here You can see what im using

yes you can use, here iam attaching excel file please find it
Book1.xlsx (8.9 KB)

it is working as expected , it is giving null value now as per file you have given some blank rows

in the query to referring to 3rd column change to 2nd column that is x(1) from x(2)

and also better add .trim after tostring

Regards

I did as you said but did not get the result . Did you got the result after i changed the file…? could please share the code Thank you in advance

if you observe the screen shot

as there are blank rows after 106 so it checking for before109 and getting the empid value but that is empty so it is returning empty only

SumValue is text variable used in assign activity

query i have used

dt1.AsEnumerable.Where(Function(x) String.IsNullOrWhiteSpace(x(1).ToString)).Last.Item(0).ToString

if you have still issue please provide screen shot of the value you got either by write line or from locals panel

and also datatable screen shot which you are you using for the query

Regards

if you want exclude the blank rows totally and only check first of empty values then
try below

dt1.AsEnumerable.TakeWhile(Function(x) String.IsNullOrWhiteSpace(x(1).ToString)).Last.Item(0).ToString

regards

Thank for your valuable time @LAKSHMI_NARAYANA_PEMMASAN . its working now Thanks a lot.

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