How to determine "Not Weekend"?

Cyrix

Client
Регистрация
16.12.2011
Сообщения
390
Благодарностей
11
Баллы
18
I want to run something only on weekdays.
I have the following If action but it's not working:

{-TimeNow.DayOfWeek-}!='Saturday' && {-TimeNow.DayOfWeek-}!='Sunday'

For example, today is Wednesday, and the above action should give a True, but in fact it gives False, on ZP 7.x.

Is there something wrong with the logic?
Thanks.
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 457
Благодарностей
5 913
Баллы
113
I want to run something only on weekdays.
I have the following If action but it's not working:

{-TimeNow.DayOfWeek-}!='Saturday' && {-TimeNow.DayOfWeek-}!='Sunday'

For example, today is Wednesday, and the above action should give a True, but in fact it gives False, on ZP 7.x.

Is there something wrong with the logic?
Thanks.
This is because you comparing date format value with text string.
Better make it on C#, check the example:
 
  • Спасибо
Реакции: Cyrix

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
This is because you comparing date format value with text string.
Better make it on C#, check the example:
I was thinking the same, but if you do just one value, it works. "{-TimeNow.DayOfWeek-}!='Saturday' " so i guess it has something to do with && operator there. BTW shouldn't all those variables starting with {- be a string, anyway?
 
  • Спасибо
Реакции: Cyrix

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 457
Благодарностей
5 913
Баллы
113
  • Спасибо
Реакции: Cyrix и lokiys

Cyrix

Client
Регистрация
16.12.2011
Сообщения
390
Благодарностей
11
Баллы
18
Thanks for the info. I will be using ||.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)