Calling all Racers for the Alteryx Grand Prix! It's time to rev your engines and race to the stage at Inspire! Sign up here.

Alteryx Designer Discussions

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

Need help to convert DateDiff statement into Alteryx from SQL.

Puneet13
7 - Meteor

I have tried to implement below status in Alteryx but it is not allowed to perform the action. Can somebody provide me the solution.

 

SQL  - convert(varchar(5),DateDiff(s, [RobotStartProcessingTime], [RobotEndprocessingTime])/3600)+':'+convert (varchar(5),DateDiff(s, [RobotStartProcessingTime], [RobotEndprocessingTime])%3600/60)+':'+convert(varchar (5),(DateDiff(s, [RobotStartProcessingTime], [RobotEndprocessingTime])%60)) as Robot_Processing_Time

 

Puneet13_0-1669188586818.png

 

4 REPLIES 4
ShankerV
14 - Magnetar

@Puneet13 

 

Can you please post what is the input and what is the output expected.

That will give more clarity to address the issue.

 

Many thanks

Shanker V

Puneet13
7 - Meteor

Input - convert(varchar(5),DateDiff(s, [RobotStartProcessingTime], [RobotEndprocessingTime])/3600)+':'+convert (varchar(5),DateDiff(s, [RobotStartProcessingTime], [RobotEndprocessingTime])%3600/60)+':'+convert(varchar (5),(DateDiff(s, [RobotStartProcessingTime], [RobotEndprocessingTime])%60)) as Robot_Processing_Time

 

Output Needs to Develop in Alteryx, unable to make formula in Alteryx.

 

Puneet13_0-1669190460705.pngPuneet13_1-1669190588717.png

 

Puneet13
7 - Meteor

Solution - tostring(DateTimeDiff( [RobotEndprocessingTime],[RobotStartProcessingTime],"hours")/3600) +":" + tostring(mod(DateTimeDiff( [RobotEndprocessingTime],[RobotStartProcessingTime],"minutes"),60 ))+":" +tostring(mod(DateTimeDiff( [RobotEndprocessingTime],[RobotStartProcessingTime],"seconds"),60) )

Felipe_Ribeir0
15 - Aurora

Hi @Puneet13 

 

Try this, it will work even for 24+ hours of difference:

 

Felipe_Ribeir0_0-1669206387373.png

 

Labels