Replace specific values of all columns of datatable

Hi All,

Below is the datatable for reference, where I want to replace all Yes to No at once using linq.

I am aware about doing it for specific column but here I want to do it for all columns.

image

@ppr please look into scenario.

Thanks,
Rishi

Hi
have a view on this for more insights

Cheers @rishiathawale

Hi @rishiathawale ,

If it is a Direct Excel Update that you are Expecting, then we could also try the below case discussed :

You would require to Replace Type.Missing with the value you want to replace.

For the Datatable way, we could check the below Linq :

OutputDT = (From r In DT.AsEnumerable
Select ia = r.ItemArray.toList
Select ic = ia.ConvertAll(Function (e) if(e.ToString.Trim.ToLower.Equals("yes"),"no",e.ToString)).toArray()
Select OutputDT.Rows.Add(ic)).CopyToDataTable()

Where OutputDT is the Clone of the Input DT.

Hi @supermanPunch

Values are not getting replaced, please check below screenshot.

Let me know if anything need to be changed.

Thanks,
Rishi

your statement is looking for res within a contains.
@supermanPunch gave a different one checking for Yes

@ppr

Yes I am looking for res thats the keyword. it should replace ideally if its present.

@Palaniyappan

not working, I guess this query is provided by @ppr in referred post.

we saw

so it made sense when it was tried to look for yes

Just do a favor for us

  • set a breakpoint (where dt_Final is already filled with the res values)
  • debug and get paused
  • use immediate panel and type in: dt_Final

share with us the outcome
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

Thanks

My Bad,

I was writing wrong DT in write range, @Palaniyappan its working

@ppr @supermanPunch Thanks for quick response.

Regards
Rishi

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