Starting With this Value to be replaced

Hi Team

In Below input data Col1 Value are start with VD,RE,TE,BG want replace the Col5 Values if No replace to Yes… Small Amount data i have showing you… i have more 24 columns in datatable.

Can you tell me how to do it linq using in UiPath

Input

Col1 Col2 Col3 Col4 Col5 Col6
VD001 ZZ YY XX Yes TT
VD003 ZZ YY XX Yes TT
VD006 ZZ YY XX Yes TT
REV01 ZZ YY XX Yes TT
REV07 ZZ YY XX No TT
TEB08 ZZ YY XX No TT
TEB10 ZZ YY XX No TT
BGRA1 ZZ YY XX No TT
BGRA8 ZZ YY XX Yes TT

Expected Output :
image

Thanks
Shyam

Hi @Shyam_Pragash

You can use the following query in the Invoke Code:

yourDt.AsEnumerable.ToList.ForEach(Sub(row)
row("Col5") = "Yes"
End Sub)

Hope this helps,
Best Regards.

Hi @arjunshenoy

i want to check the condition on Col1 those values are stating with {VD,RE} based on that value Col5 columns to values to be replaced

Thanks
Shyam

@Shyam_Pragash

Well, in that case, you can utilise the following query:

yourDt.AsEnumerable.ToList.ForEach(Sub(row)
row("Col5") = if(row("Col1").ToString.Contains("VD") OR row("Col1").ToString.Contains("RE"),"Yes",row("Col5").ToString)
End Sub)

Hope this helps,
Best Regards.

Hi @arjunshenoy

Thanks :slight_smile:

Any Other Methods do have which can make it to use multiple columns.

Thanks
Shyam

@Shyam_Pragash

You can incorporate multiple conditions in the same query for multiple columns.

Hope this helps,
Best Regards.

Hi @arjunshenoy

Thanks :slight_smile:

1 Like

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