Page 1 of 1

stage variable question

Posted: Tue Jan 21, 2014 4:06 pm
by times29
Input_Lnk

Parent_code child_code CHILD_SK PARENT_SK
00.1 1
ABC.20 ABC 2
ABC.20 CDE.20 3
ABC.20 EFG.20 4
BDE.20 ABC.20 5

I am using stage varaible to get parent_sk like below

in stage varaible i said

Input_Link.child_code StageVar


In Transformer to populate PARENT_SK i said

IF (Input_Lnk.Parent_code= StageVar) THEN Input_Lnk.CHILD_SK ELSE 1

i am getting all parent_sk as 1

i should have get

Parent_code child_code CHILD_SK PARENT_SK
00.1 1 1
ABC.20 ABC 2 5
ABC.20 CDE.20 3 5
ABC.20 EFG.20 4 5
BDE.20 ABC.20 5 5

Posted: Tue Jan 21, 2014 6:21 pm
by ray.wurlod
Format your post using Code tags so it's clear what's happening. It's too difficult to fathom with the way you've presented your information.

Posted: Tue Jan 21, 2014 8:01 pm
by times29

Code: Select all

Parent_code child_code CHILD_SK PARENT_SK
               00.1        1
ABC.20         ABC         2       null
ABC.20         CDE.20      3       null
ABC.20         EFG.20      4       null
BDE.20         ABC.20      5       null
i want to update parent_sk as below based upon join from parent_code with child_code:

Code: Select all

Parent_code child_code CHILD_SK PARENT_SK
               00.1        1       null
ABC.20         ABC         2       5
ABC.20         CDE.20      3       5
ABC.20         EFG.20      4       5
BDE.20         ABC.20      5       null

StageVar:

Input_Link.child_code StageVar


Transformer:

IF (Input_Lnk.Parent_code= StageVar) THEN Input_Lnk.CHILD_SK ELSE 1

i am getting all parent_sk as 1


Posted: Wed Jan 22, 2014 6:15 am
by battaliou
I am reading this as follows:
IF (Input_Lnk.Parent_code= Input_Link.child_code) THEN Input_Lnk.CHILD_SK ELSE 1

Posted: Wed Jan 22, 2014 9:03 am
by times29
Agree so what should it be

stage variable question

Posted: Thu Jan 23, 2014 3:54 pm
by sam paul
Based on the way I understood your question and input data, no Parent Code is matching with Child code, so it goes to ELSE part of your code and prints 1 which is correct. :)