Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Announcement | We'll be doing maintenance between 2-3 hours, which may impact your experience. Thanks for your patience as we work on improving the community!
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Formula not evaluating correctly

Deano478
12 - Quasar

Hi everyone,

 

I've run into a bit of an issue that you experts may be able to help me solve basically see the Workflow attached the formula inst evaluating the time correctly maybe its something I'm not seeing but any help to resolve this issue is much appreciated I've been banging my head over this issue.

 

Huge thanks to those who take the time to respond.

 

 

 

 

 

 

 

5 REPLIES 5
ShankerV
17 - Castor

Hi @Deano478 

 

You have divided into two formula for checking to different conditions.

The output is stored in the same column deadline.

 

ShankerV_0-1670596421750.png

 

 

Many thanks

Shanker V

 

 

DataNath
17 - Castor
17 - Castor

Hey @Deano478, I've not used this macro before but if you're evaluating the current time, it's a little redundant as it outputs a string which you can't evaluate against a time in this sense.

 

DataNath_1-1670596627762.png

 

 

You may as well just use the native DateTimeNow() function alongside a constructed DateTime using DateTimeToday()+ your target times, to conduct the checks. You'll also need to stack your checks as part of an elseif statement as, if you put different time ranges within the same field, there'll always be multiple that fail and you'll always end up with 'Error'. You could use something along these lines:

 

DataNath_0-1670596568821.png

ShankerV
17 - Castor

@Deano478 

 

Even as I am running the workflow now at 20:05:00, I changed the condition to 21:00:00

Still I get the output as error.

Becos it checks the first condition, writes the output as Deadline1, then checks the second formula and it is failing and hence overwrites as Error.

 

ShankerV_0-1670596588314.png

 

ShankerV
17 - Castor

@Deano478 

 

To overcome the issue, try the below if it works for you.

 

IF [DateTimeNow] >= '14:00:00' AND [DateTimeNow] <= '21:00:00'
THEN "Deadline 1"
elseIF [DateTimeNow] >= '10:00:00' AND [DateTimeNow] <= '11:00:00' THEN "Deadline 2"
ELSE "Error" ENDIF

 

ShankerV_0-1670596731155.png

 

ShankerV_1-1670596747694.png

 

ShankerV_0-1670596915597.png

 

 

 

Deano478
12 - Quasar

@DataNath  that's a really neat solution and I just gave it a quick test and it works like charm I never would have come up with a solution like that so thank you for taking the time to respond to my query 

Labels
Top Solution Authors