Check Columns Value Write Yes or No

Hi…

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:
image

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

above code unable to write value in VRM Columns.

Thanks
Shyam

Hi @Shyam_Pragash ,

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 ?

Hi @supermanPunch

Change the to VRN Last Column Name… Typing Mistake.

Thanks
Shyam

Hello @Shyam_Pragash ,

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

LINQ will not work in this way. Have a look here for an introduction for column value updates:
How to Update Data Column Values of a Data Table | Community Blog

@Shyam_Pragash ,

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.

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