Page 1 of 1

Calculating different due dates based on installment number.

Posted: Thu Feb 26, 2009 6:45 am
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?

Posted: Thu Feb 26, 2009 7:13 am
by chulett
Do you know what the maximum installment count can be?

Posted: Thu Feb 26, 2009 7:27 am
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.

Posted: Thu Feb 26, 2009 3:09 pm
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.

Posted: Thu Feb 26, 2009 3:15 pm
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.

Posted: Thu Feb 26, 2009 3:21 pm
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.

Posted: Fri Feb 27, 2009 3:34 am
by hcdiss
so is there no way that i can handle this approach!!!!

Posted: Fri Feb 27, 2009 3:46 am
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.

Posted: Fri Feb 27, 2009 3:47 am
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:

Posted: Fri Feb 27, 2009 3:53 am
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.

Posted: Fri Feb 27, 2009 4:06 am
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.

Posted: Fri Feb 27, 2009 1:17 pm
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.