Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey, i need to count hours between dates. The problem is there is a 1:n. So i have to use a while or something else.
Could someone help how to do ?
I need the following:
There are a lot of ticketnumbers in the system. Example attached(1). I need to count all the pause times in hours.
A Ticketnumber can have more that one pause in their lifetime. Now i have to search if there is ActivityAction 5. Use this CreationDate, go to the next event and use this as ClosedDate if this is not a 5 and try to get the duration between the two dates. Is that possible ?
BR Christian
Hi, no need for a loop
You could try something like this:
load
TicketNumber,
ActivityDesc,
ActivityAction,
Actcreate,
if(ActivityAction = 5 and peek('TicketNumber', -1) = TicketNumber, (peek('Actcreate', -1) - Actcreate) * 24) as PauseDurationHours
RESIDENT [your source table]
ORDER BY TicketNumber, Actcreate desc;
Hi, no need for a loop
You could try something like this:
load
TicketNumber,
ActivityDesc,
ActivityAction,
Actcreate,
if(ActivityAction = 5 and peek('TicketNumber', -1) = TicketNumber, (peek('Actcreate', -1) - Actcreate) * 24) as PauseDurationHours
RESIDENT [your source table]
ORDER BY TicketNumber, Actcreate desc;
Thanks for helping. It works fine.