Last week date range check

Hello Friends,
Book2.xlsx (8.2 KB)

I am searching a value in previous week date range, if that value found in any date then bot exit from that loop until bot search each line of item of previous week date range.

see in above screenshot, bot should go through only previous week date range only and exit when condition match.

Please help me
if possible please use linq queries for this.

Hi @Jeeru_venkat_Rao

You can use the solution below.

In For each row activty you can get the date as DateTime like:
Datetime.ParseExact(CurrentRow.Item(“Visit Date”).ToString,“MM/dd/yyyy hh:mm:ss”,System.Globalization.CultureInfo.InvariantCulture)

Then, in If condition you should control the date if it is in previous week range like:
now.AddDays(-(now.DayOfWeek))>currentDate and currentDate > now.AddDays(-(now.DayOfWeek)-7)

Make sure that ‘currentDate’ variable type is System.DateTime

Hope this helps,
Regards.

Its working fine but I required only MM/dd/yyyy but when I am using toshortdate.tostring then its not goto Then part. It give wrong output.

May I know why you want to use it that way?

Hi @Jeeru_venkat_Rao
Convert it into string inside if or else block as required