Scenario needs to be solved

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
devesh_ssingh
Participant
Posts: 148
Joined: Thu Apr 10, 2008 12:47 am

Scenario needs to be solved

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
paultechm
Participant
Posts: 27
Joined: Wed Jul 25, 2007 2:09 am

Post 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)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
paultechm
Participant
Posts: 27
Joined: Wed Jul 25, 2007 2:09 am

Post by paultechm »

Sorry , I haven't noticed your comments , I know that the post doesn't have much explanation of the requirements .
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Much? Any. Hence the issue.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply