@Cormac It’s always possible to combine many ifs, but for readability it is better to separate into different if statements.
Personally, I would have 2 date variables I’ll call startDate and endDate. This allows you to specify a range to download. This range can be a single day (Jan 15 at 12:00am through Jan 15 at 11:59pm) or it can encompass a weekend (Jan 10 at 12:00am through Jan 12 at 11:59pm). It also makes it so only a single if statement is required
Your if statement should determine if today is Monday. If today is monday that means we want to compare fri-sun instead of only the previous day. That can be done with a statement similar to the one provided by @YAZIDI which is:
CInt(today.DayOfWeek) = 1
If this is true (meaning today is monday) then on the true side, you want to set the startDate to be friday at midnight. On the false side you would set the startDate to be the previous day at midnight. Whether it’s true or false, we want the endDate to be the previous day at 11:59pm
Assign startDate = today.addDays(-3)
Assign startDate = today.addDays(-1)
Outside of the if statement:
Assign endDate = today
Now when you gather the the files you can supply the date range that is greater than or equal to the startDate and less than (not less than or equal to!) the endDate.
Something to keep in mind too - whenever you are working with dates you should also be cognizant of dates changing midway through your workflow if you start it close to the end of the day, or if it is extremely long running. You may wish to assign a static variable containing today’s date at the beginning of your workflow instead of using the dynamic ‘today’ which calculates the current day at that specific point during runtime