Date Values within some limit

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
Amarpreet
Participant
Posts: 20
Joined: Tue Apr 04, 2006 11:45 pm
Location: India
Contact:

Date Values within some limit

Post by Amarpreet »

I have a scenario wherein I have to generate date values within some limit. I have to fetch min(cal_date) and max(cal_date) from my source table and generate date values within these values in my target table.
How can I pick these dates and generate the date values from min(cal_date) and max(cal_date) dynamically in my job?
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

Try using column generator stage.
Amarpreet
Participant
Posts: 20
Joined: Tue Apr 04, 2006 11:45 pm
Location: India
Contact:

Post by Amarpreet »

But I don't want to hard code the limits, but have to pick them from source table. How can I achieve this by using column/row generator?
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Have max(date) and Min(date) from the source, use transformer and stage variable to check till the limit of Max(date) and increment the current date by 1 for each record.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use a Column/Row Generator stage with job parameters for the limits.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Passing parameter to the stages may require to split the job.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Passing parameter to the stages may require to split the job.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
thompsonp
Premium Member
Premium Member
Posts: 205
Joined: Tue Mar 01, 2005 8:41 am

Post by thompsonp »

Which database are you using?

Do you only ever get 1 minimum value and 1 maximum value from the database, or do you get 1 min and 1 max for each set of key values in the source table i.e. are you grouping by some key values?
clshore
Charter Member
Charter Member
Posts: 115
Joined: Tue Oct 21, 2003 11:45 am

Post by clshore »

If you have a date dimension table in your DB, this is easy:

SELECT
dateColumn
FROM DateDimTable
WHERE dateColumn BETWEEN minDate AND Maxdate
ORDER BY dateColumn

Use this stream of date values to create your target records

Carter
Post Reply