Expand my Community achievements bar.

SOLVED

Advanced Expression to Test Current Time

Avatar

Level 2

The current expression is ending the workflow at 7pm but we need it to continue to run until 10:50.

 

This is the function we are using in a test activity.  What is weird is in one workflow this same formula runs until after 11 while in another it ends at 7pm.


Iif((Hour(GetDate()) > 6 AND Hour(GetDate()) <23), 1, Iif(((Hour(GetDate()) == 6 AND Minute(GetDate()) >= 30) OR (Hour(GetDate()) == 22 AND Minute(GetDate()) <= 50)), 1, 0))

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

I would suggest using a segmentation activity instead of a test activity to achieve the same. In the Query activity, add additional data to get the hour and minute and use that within the segmentation activity.

Thanks, Sathees

View solution in original post

6 Replies

Avatar

Community Advisor

@Hankins0202 A similar issue has been discussed on this thread

Thanks, Sathees

Avatar

Level 2

I looked there while I think that could be part of the issue. I actually think the conditional statement might be incorrect

 

Avatar

Community Advisor

I don't think that the test activity is not working for the function that you mentioned. Can you tell me what's the requirement? and How frequently the workflow is running etc,.

Thanks, Sathees

Avatar

Level 2

The requirement is to test the current time, if the current time is between 6:30 am and 10:50pm we want to run the rest of the workflow.  If that time is outside of those hours in the Easter time zone than we want the workflow to end.

Currently it works right up until 7PM.  Than it is saying its outside of time condition.

Screenshot 2024-05-08 at 9.37.43 PM.png

Avatar

Correct answer by
Community Advisor

I would suggest using a segmentation activity instead of a test activity to achieve the same. In the Query activity, add additional data to get the hour and minute and use that within the segmentation activity.

Thanks, Sathees