Page 1 of 1

Scenario needs to be solved

Posted: Fri Nov 25, 2011 4:53 am
by devesh_ssingh
Hi All,

I have come accross one scenario, kindly help me to solve it.

i/p

Emp_id IN_Time Out_time
1234 09:30 10:30
1234 11:00 14:00
1234 15:00 17:00
1234 17:30 18:30

O/p

Emp_id IN_Time Out_Time Productive_time Idle_time
1234 09:30 18:30 7hrs 2hrs

regards,
D

Posted: Fri Nov 25, 2011 7:52 am
by chulett
Please try to come up with more descriptive subject lines, pretty much everything here is a "scenario that needs to be solved". Also, rather than force people to puzzle out the relationship between the input and the ouput examples, it is always best to spell out your requirements in words. Explain to us rather than make us guess or work out how to get there from here.

Posted: Fri Nov 25, 2011 1:43 pm
by ray.wurlod
How do you calculate productive time? How do you calculate idle time? Could this be different for different employee types? What other business rules have you neglected to mention? Does the organisation have a PHB?

Posted: Fri Nov 25, 2011 4:39 pm
by paultechm
Create a column called Productive_time in transformer with value as Out_time-IN_Time

Emp_id IN_Time Out_time Productive_time
1234 09:30 10:30 1
1234 11:00 14:00 3
1234 15:00 17:00 2
1234 17:30 18:30 1

pass this to an aggregator stage group with Emp_id and calculate min(in_time),max(out_time),sum(Productive_time) and
Idle_time can be calculated as (max(out_time)-min(in_time))-sum(Productive_time)

Posted: Fri Nov 25, 2011 6:24 pm
by chulett
Paul, thanks for helping out but just want to point out that you seem to be missing the point of our responses. Ray or I could have put together a very similar reply based on our understanding of what was posted.

However, in the spirit of "teach a man to fish" we prefer to take a moment to help educate posters on how to ask for help, to include enough information so that their problem can be understood and hopefully solved without ambiguity. Simply posting a sample of the Input and desired Output with no explanation of the requirements or what (if anything at all) that they have tried is one of my pet peeves. I don't really believe in 'Silver Platter' answers and would nuch rather help someone work it out by themselves as much as possible. And a big part of that is properly explaining the scenario that needs to be solved and what they've tried up to this point, rather than simply presenting it as if it were some puzzle for us.

My two cents.

Posted: Sat Nov 26, 2011 3:31 am
by paultechm
Sorry , I haven't noticed your comments , I know that the post doesn't have much explanation of the requirements .

Posted: Sat Nov 26, 2011 7:17 am
by chulett
Much? Any. Hence the issue.