Calculating different due dates based on installment number.

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
hcdiss
Participant
Posts: 26
Joined: Sat Oct 14, 2006 1:45 am
Location: Boston

Calculating different due dates based on installment number.

Post by hcdiss »

Current Scenario---->

There is a customer table with customer number and number of installments taken by them.A date for payment is also set

Input Table --->

CUSTOMER_NO INSTALLMENT_NO DATE
123 2 12-03-2009

Required Output

We need to generate the installment dates for the customer.Suppose there are 2 instalments left for customer 123 , then we need 2 records in output and also the two due dates ( due date = date+ 30 days)

CUSTOMER_NO DUE_DATE
123 12-04-2009
123 12 -05-2009

How do i incorporate this?
hcdiss
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Do you know what the maximum installment count can be?
-craig

"You can never have too many knives" -- Logan Nine Fingers
hcdiss
Participant
Posts: 26
Joined: Sat Oct 14, 2006 1:45 am
Location: Boston

Post by hcdiss »

[quote="chulett"]Do you know what the [i]maximum[/i] installment count can be? ...[/quote]

Unfortunately, No
and thats why i am stuck :(

But may be we can take installment count = 50 ( at the max) for now to get going with this.
hcdiss
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It doesn't matter whether it's two or 50 or millions, you're going to need some code. It might be a BuildOp, or you may prefer to script it and use an external filter stage. Or you may like to encapsulate your code in an Oracle stored procedure and call that.

I believe there will be a looping construct in the Transformer stage in version 8.2 but, for now, there isn't.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I was thinking that if the number was small enough, one could create that many output links from a transformer and then merge them back together after that.
-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 »

That crossed my mind briefly also, but I felt that INSTALLMENT_NO would be different in different rows, which makes that approach messy. Doable, but messy.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
hcdiss
Participant
Posts: 26
Joined: Sat Oct 14, 2006 1:45 am
Location: Boston

Post by hcdiss »

so is there no way that i can handle this approach!!!!
hcdiss
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Cross it with a generated list of values like below

Installments,InstallmentMonthNo,Days
0,0,0
1,1,30
2,1,30
2,2,60
3,1,30
3,2,60
3,3,90
..........
........
50,1,30
..........
50,50,1500

This will give you both months and days.

You will have to configure you reference, but I will leave that to you.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What part of my initial response, which mentioned three ways you can approach this, gives you the impression that there is no way you can handle it?
:roll:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post by Kirtikumar »

Here is one approach:

Generate first CustNo col with 50 columns for dates and then use the pivot stage to get 50 rows for the same customer.
Regards,
S. Kirtikumar.
hcdiss
Participant
Posts: 26
Joined: Sat Oct 14, 2006 1:45 am
Location: Boston

Post by hcdiss »

hey ray,

Sorry about that, actually i am not a premium member hence was unable to read the post as it was marked premium.
hcdiss
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Well that, at least, is easily remedied.

Premium membership is not expensive, at less than 30c per day, and helps to fund the hosting and bandwidth costs incurred by DSXchange.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply