How to replace date based on a condition

I have two columns - DocumentDate, ServiceDate
Where I have a scenario on, - If the ServiceDate consists of the year ‘1900’ then use the document date.

any inputs?


Try this

Read range and use a for each row activity. inside the for each row, use an if activity and the condition could be row(“Column name”).ToString.Conatins(“1900”)

then your “use it” action will follow inside the then section. let me know if this helps.

I’m unable to do it, Could you please help me with a sample bot!

Try it plz. (1.9 KB)

1 Like

I have tried the above xaml, but getting the below error.

Attached the file and xaml.
DateSample.xaml (10.3 KB) Sample File.xlsx (72.4 KB)

It’s strange.
I try the sample you give but I don’t know why the only column A cannot convert to string.
I did my best but I’m sorry.

Also, it is updating each row which is time taking. So, Is there any way using Linq queries?
Like this?
(From d In test_table.AsEnumerable
Let nn =(Replace(str,row(d(“Service End”).toString).contains(“1900”),d(“Document Date”)))
Let ra = {d(0),d(1),d(2),nn}
Select test_table.Rows.Add(ra)).CopyToDataTable