Hi all,
First let me thank you to help me. I really appreciate it. Now I need help in the following situation. My files look like this
INPUT OUTPUT
------- ---------
Field-a Out-a
Field-b-typ Out-x
Field-b-val Out-y
Field-c-typ Out-z
Field-c-val
Field-d-typ
Field-d-val
Now the derivation rules are as follows:
1) Out-a from Field-a
2) Out-x from Field-b-val if Field-b-typ = 'x' or from Field-c-val if Field-c-typ = 'x' or from Field-d-val if Field-d-typ = 'x'
3) Out-y from Field-b-val if Field-b-typ = 'y' or from Field-c-val if Field-c-typ = 'y' or from Field-d-val if Field-d-typ = 'y'
4) Out-z from Field-b-val if Field-b-typ = 'z' or from Field-c-val if Field-c-typ = 'z' or from Field-d-val if Field-d-typ = 'z'
So is anybody can tell to do this without using complicated logic in a "Transform" stage.
I really appreciate your help.
Thanks,
Hemanta
populate output field depending on differnt value from input
Moderators: chulett, rschirm, roy
populate output field depending on differnt value from input
Hemanta Bhattacharyya
Hi Hemanta,
Welcome to DSXchange!!! :D
I belive that, its metadata that you have given as INPUT and OUTPUT.
Hope you dont feel this as complicated.
Welcome to DSXchange!!! :D
I belive that, its metadata that you have given as INPUT and OUTPUT.
Code: Select all
1)Map Out-a to Field-a.
2) For Out-x
If Field-b-typ = 'x' Then Field-b-val Else If Field-c-typ = 'x' Then Field-c-val Else If Field-d-typ = 'x' Then Field-d-val
3) Out-y
If Field-b-typ = 'y' Then Field-b-val Else If Field-c-typ = 'y' Then Field-c-val Else If Field-d-typ = 'y' Then Field-d-val
4) Out-z
If Field-b-typ = 'z' Then Field-b-val Else If Field-c-typ = 'z' Then Field-c-val Else If Field-d-typ = 'z' Then Field-d-valHope you dont feel this as complicated.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
-
ray.wurlod
- Participant
- Posts: 54595
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Something like the derivations that kumar_s has given are as simple as you will ever get it; they map your requirements exactly. The actual derivations are syntactically incorrect, since there is no corresponding Else for the final Then (and there must be).
You DO have to do the condition testing (If..Then..Else) and select the input values accordingly. This is YOUR specification!
Out-a is derived as
Out-x is derived as
You have not specified the value to be generated if none of Field-b-typ, Field-c-typ or Field-d-typ is "x". I have provided "???" as this value; change this as you see fit.
The other two output columns will have similar derivations.
If you find this too complex you can evaluate the individual results into stage variables, and apply the logic to those.
You DO have to do the condition testing (If..Then..Else) and select the input values accordingly. This is YOUR specification!
Out-a is derived as
Code: Select all
Inlink.Field-aOut-x is derived as
Code: Select all
If Inlink.Field-b-typ = "x" Then Inlink.Field-b-val Else If Inlink.Field-c-typ = "x" Then Inlink.Field-c-val Else If Inlink.Field-d-typ = "x" Then Inlink.Field-d-val Else "???" You have not specified the value to be generated if none of Field-b-typ, Field-c-typ or Field-d-typ is "x". I have provided "???" as this value; change this as you see fit.
The other two output columns will have similar derivations.
If you find this too complex you can evaluate the individual results into stage variables, and apply the logic to those.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.

