End Date Calculation

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
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

End Date Calculation

Post by maffan76 »

hi,
I have 2 columns Date, Time and third column contains duration. i want to calculate the end date time based on these 3 columns. Can someone please throw some light to how to accomplish it efficiently as i ahve to process large amount of data. Also hows does PX internally manipulates the Datetime data.

p.s.
Is is possible to convert everything in Seconds and then adding the duration and convert it back to timestamp?

Thanks in advance.
Regards,
Affan
"Questioning is Half Knowledge"
dwandbi
Participant
Posts: 29
Joined: Sat Feb 04, 2006 6:17 pm

calculate

Post by dwandbi »

convert the duration into number of days and add them to date in datetime format and this becomes the end date in your case. Make sure in what format the duration exists in your case.
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

Post by maffan76 »

hi,
The duration is in Seconds and want to calculate the end date based on that.
Regards,
Affan
"Questioning is Half Knowledge"
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

Post by maffan76 »

hi
Done it using TimestampFromDateTime & TimestampFromSecondsSince. The only question left is that is this an efficient way of calculating the end datetime?
Regards,
Affan
"Questioning is Half Knowledge"
dwandbi
Participant
Posts: 29
Joined: Sat Feb 04, 2006 6:17 pm

Post by dwandbi »

Untill unless you are getting correct end date for all different combinations, your way of calculation is correct,

thanks,
Tom
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

If you concern is more into processing efficiency you may try using Modify stage instaed of transofmer stage.
You can find the simila funciton avialable there.

Code: Select all

timestamp_from_seconds_since[timestamp](dfloat)
timestamp_from_date [time](date)
timestamp_from_time
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
maffan76
Participant
Posts: 110
Joined: Tue Aug 23, 2005 5:27 am

Post by maffan76 »

But i have to transform the other columns as well i-e applying business rules to other columns, so is it a good idea to put the modify stage and then pass the data to transformaer for applying the business rules.

Also whats the best practice for the situation where mix of rules exist e.g. Data type Conversions, Date Claculations, Applying calculations.

Thanks in advance.
Regards,
Affan
"Questioning is Half Knowledge"
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

If there is a need of transformer, it is always advisalbe to accomplish all the logic in the same stage (not overloaded) inorder to avoid the additional buffering of data, memory usage, disk usage (IO).
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply