i have the check the values in specific columns name (Location)… Write Data in columns (VRM) Yes or No.
Sl.No
VRM
Location
TRM
VPR
VRN
1
Goa
xx
xx
xxx
2
No
xxx
xx
xxx
3
Yes
Mumbai
xxx
xx
xxx
4
xx
xx
xxx
5
AP
xx
xx
xxx
Expected Output:
Tried Code…
(From row In Dt_Read.AsEnumerable()
Let A =If(String.IsNullOrEmpty(row("Location").ToString),"Yes","No")
Select Dt_result.Rows.Add(row("VRM"),A)
).CopyToDataTable
We notice from your input data that there are two columns with the same name, We cannot use the Column Names in such cases, we might need to go about with the Column Indices.
But we would also like to know What was the Error that you received and Were you able to Read the Excel sheet using Read Range Activities with Add Headers Enabled ?
Here do you need the VRM do be updated as “Yes” & “No” alternatively?
Also in the table whcih you are maining, same column headers will not work if you are using Read Range activity. If you just want to update the VRM based on Location, what you can do is
use Excel
Use for each row in excel
add the if condition (Location is not null), then Write cell, yes…else No
In that case, Could you Try the Below Updated Query :
(From row In Dt_Read.AsEnumerable()
Let A =If(String.IsNullOrEmpty(row("Location").ToString),"No","Yes")
Select Dt_result.Rows.Add(row("Sl.No"),A,row.ItemArray.Skip(2))).CopyToDataTable
However, For such a Simple Updation, we could go with a For Each Row Activity and Update the values.