Using Switch to perform different activity based on weekofday

So i’m trying to navigate to my meetings and i want to take system date to determine what day of week it is and then use it in switch to trigger activity based on week of day. any help is appreciated.

Hi @VinnyThePooh ,
Welcome to UiPath Forum :slight_smile:

use below condition to check week day
DayOfWeek today = DateTime.Today.DayOfWeek;
// Test current day of week.
if (today == DayOfWeek.Monday)
{
Console.WriteLine(“DO WORK”);
}

Regards,
Arivu

Hi

Welcome to uipath forum

Hope the below steps would help you resolve this

  1. Use a assign activity like this

str_date = Datetime.Now.ToString(“dddd”)

Where str_date is a string variable

  1. Then use a SWITCH activity where in the expression mention like this

str_date

And in each case mention the value as Monday, Tuesday, Wednesday,….

Now under each cases you can include the set of activities you want to trigger

Based on what day you get the corresponding activities will get triggered

For more details on switch activity and how to use it

Cheers @VinnyThePooh

1 Like

doing so gives me this error

could you demonstrate it in the studio

Do the same in assign activity above.

Thanks

We can assign value to a variable either directly from variable panel like how you have done now or
With assign activity

So delete that assign activity as you have already assigned it in variable panel

Directly go for switch activity

Refer the doc shared above for more details on how to use that activity

Cheers @VinnyThePooh

image
I still keep getting this error

Pls try the typing the same expression from your end
@VinnyThePooh