-2

Is there a function for printing only weekdays via automation anywhere? I want to try print last 2 weekdays in present day. Any idea? Thanks.

yescience
  • 3
  • 2
  • can you give an example ? – Clint Apr 29 '18 at 04:02
  • Im using sas enterprise guide. At sas EG; there is a program that runs with macro. İ want to print t-1 and t-2 in the present day. Lets assume that we are on 25 April and for example program runs like this; %let startdate='24.04.2018dt:0:0:0' %let enddate='23.04.2018dt:0:0:0' When it is 26 april the function should be like this; %let startdate='25.04.2018dt:0:0:0' %let enddate='24.04.2018dt:0:0:0' As a result the function should update the automatically and it must contain only weekdays. İm trying to do this with AA. – yescience Apr 29 '18 at 18:59

2 Answers2

0

yes you can do it, it's pretty easy just you need to get actual Date from system variables and subtract from it number of days that you need.

Check BOT below: enter image description here

Format of system date is mm/dd/yyyy hh/mm/ss so you need to cut of the second part of it.

enter image description here

Final result:

enter image description here

Piotr
  • 161
  • 1
  • 1
  • 13
  • @yescience ...is there a way to output all the weekdays in the current week? for example: 05/12/2019, 05/13/2019, 05/14/2019, 05/15/2019 ...etc – user1724708 May 17 '19 at 19:32
0

I believe with plain AutomationAnywhere it's not possible, but you can write it in C# and implement it as a metabot. for exmaple :

DateTime Date = DateTime.Now;
        for (int i = 0; i < 7; i++)
        {
            DateTime DayOfWeek = Date.AddDays(i);               
            if (DayOfWeek.DayOfWeek.ToString() == "Monday" && i != 0)
            {
                break;
            }
            string result = DayOfWeek.ToString("MM/dd/yyyyy");
            Console.WriteLine(result);
        }
        Console.ReadKey();
Piotr
  • 161
  • 1
  • 1
  • 13