Page 1 of 1

Looping in Transformerstage

Posted: Thu Nov 19, 2009 1:21 am
by vinsashi
MY SOURCE DATA HAS THESE COLUMNS
UOM
PARENTMEASURE
PARENTLEVEL
CURRENT LEVEL
PARENTROLLUPOPERATOR
AMOUNT

COST PROFIT 0 1 -
DIRECTCOST COST 1 2 + 75
INCOME PROFIT 0 1 +
NETINTERESTINCOME INCOME 1 2 + 100
PROFIT PROFIT 0 0 +
INDIRECTCOST COST 1 2 + 10

I WANT
OUTPUT LIKE
PROFIT INCOME-EXPENSE=15

pLZ HELP HOW TO DO THIS ONE
HERE LOT OF DATA WIL COME LIKE THIS SO I NEED TO GROUP WITH CURRENTLEVEL AND PARENTMEASURE

THANKS IN ADAVANCE
VIN....
[/list]

    Posted: Thu Nov 19, 2009 1:37 am
    by ray.wurlod
    1. Don't shout. All upper case is regarded as shouting and is offensive.

    2. Can you please be clearer about your requirements. I have no idea what the numbers mean. Use code tags to preserve spacing.

    3. I doubt that any looping will be involved.

    Posted: Thu Nov 19, 2009 2:01 am
    by vinsashi
    Hi ray,
    My source is like this
    UOM PARENTMEASURE PARENTLEVEL CURRENT LEVEL PARENTROLLUPOPERATOR AMOUNT
    COST PROFIT 0 1 -
    DIRECTCOST COST 1 2 + 75
    INCOME PROFIT 0 1 +
    NETINTERESTINCOME INCOME 1 2 + 100
    PROFIT PROFIT 0 0 +
    INDIRECTCOST COST 1 2 + 10


    my source data is like this.here i want to implement loop.
    if we observe cost(underparent measure) is parent for directcost and indirectcost and for that operator is + .so we should add amount then that we should assign to cost(75+10=85)
    same like netintrestincome is child of income so income should 100
    finally profit is parent of cost and income(but here means in first record for cost and profit parentrollupoperator is '-(minus) and in third record for income and profit rollup operator is '+')
    so profit=income-cost
    so here for understanding i given some records but in future we wil get more records

    i need to implement looping here(lowerlevel data should add r minus to upper level depend upon operator


    Thanks in Adavance
    vin...

    Posted: Thu Nov 19, 2009 6:36 am
    by chulett
    There's no "looping" inside a job, there is however "aggregation" which this seems like it might be.

    Posted: Thu Nov 19, 2009 6:52 am
    by vinsashi
    Hi chulett,
    i said that one sample data.in source data i wil get so many levels. according to that one i have to do operation.for example
    CM PM CL PL OP AMOUNT
    A A 1 1 +
    B A 2 1 + 10
    D C 4 3 - 5
    C B 3 2 + 10
    H G 5 4 + 5
    G F 4 3 + 5
    F

    Posted: Thu Nov 19, 2009 7:10 am
    by vinsashi
    Hi Chulett,
    i didnt mentioned clearly in previous message.
    CM PM CL PL OP AMT
    A A 1 1 +
    B A 2 1 + 10
    D C 4 3 + 5
    E A 2 1 -
    C B 3 2 + 10
    F E 3 2 + 5
    G F 4 3 + 10
    H G 5 4 + 5


    WHERE CM=CURRENT MEASURE PM=PARENT MEASURE
    CL=CURRENT LEVEL PL=PARENT LEVEL OP=OPERATION BETWEN THEM AMT=AMOUNT

    HERE GROUP BY CL ,PM,CL AND WE HAVE TO FIND OUT OPEREND ACCORDING TO THAT WE HAVE TO PERFORM OPERATION
    AND WE SHOULD ADD CURRENT MEASURE DATA TO THAT PARENT MEASURE(SO HERE WE NEED LOOPING)
    DESIRED OUTPUT IS LIKE THIS
    OUTPUT
    CM PM CL PL OP AMT
    A A 1 1 + 5
    B A 2 1 + 25
    D C 4 3 + 5
    E A 2 1 - 20
    C B 3 2 + 15
    F E 3 2 + 20
    G F 4 3 + 15
    H G 5 4 + 5


    Thanks in adavance
    vin..

    Posted: Thu Nov 19, 2009 7:31 am
    by ray.wurlod
    Please use Code tags to make your layout clear. For example:

    Code: Select all

    CM  PM  CL  PL  OP  AMT 
    A   A   1   1   + 
    B   A   2   1   +   10 
    D   C   4   3   +    5 
    E   A   2   1   - 
    C   B   3   2   +   10 
    F   E   3   2   +    5 
    G   F   4   3   +   10 
    H   G   5   4   +    5 
    
    That having been done, can you please try to paraphrase your exact requirement; I must profess myself still confused.

    I suspect all you need is a conditional lookup (level > 0) to retrieve the parent measure.