Expression in Studio X

What kind of expression should I use to fill in a search field (type into) so, that I get all the dates that are before this day minus one week?

DateTime.Now.AddDays(-7).ToString(“dd.MM.yyyy”)

This gives me the date today minus 7 days, but what I need is all the dates before that.

Can anyone help me with this?

Thank you!

Hi @JJ65

Do you need all the dates till the first of the month? Or till when?

I need all the dates before a day 1 week ago, so I need all the dates exept the 7 days back from today

Yes, but starting from where? From the beggining of the month? The year? The centuary? From the Big Bang?

from the current date, I plan to run this on a daily basis

I’m not understanding.

Considering today, you need the 10th, 9th, 8th,… Where should this end? 1st of November? 1st of January 2020? or when?

Sorry, this is difficult to express. I need to make my bot consider all the dates, that exist 8 days or earlier comapred to current date = today. It is no problem to bot, because there will be only limited number of cases in the system I´m automating here

It could as well be in range “one year ago - 8 days ago”

Ok, perfect

So:

First step to implement should be create an integer variable Days with Default = 7.
Create a “While” Loop with condition Today.ToString(yyyy)=Today.AddDays(-Days).ToString(yyyy).
In the loop you insert the search and all the operation relative to the search (downloads, data scraping ecc.)
Last step of the loop should be Days=Days+1

A more advanced implementation can be done if you find a condition to know when there are no more results to find (e.g. there are no more results, there have been X days without results, ecc.)

If you have such a condition, i can help you with that too

1 Like