Checking public holidays against todays date minus 2

I have a list of South African public holidays in a variable.

I am using a for each loop to check if todays date minus two was a public holiday if it was I don’t do anything but if not I am perfoming some functions, but I must perfom those functions once but the holidays are 19, so it will check each holiday and perfom the function many times.

It works fine but I only need to check if todays minus two date is in that list of holiday date and if it is not perfom the function once.

What error do you get when playing this action?

I am not getting any error, my only problem is if todays date is not equal the first holiday item in the loop it will run and check the next and run I only need it to check the whole list and then run the next step.

Should I use list contains and remove for each statement?

Yes, list contains should work since you convert the date to string and the dates in the list are all int he same format.

Thanks it worked I was just afraid that it will check each alphabet or number in the list

No, it should not. It should check all values in the list variable against the whole string in this If-Else condition.

Thanks it worked, problem solved

1 Like