Hi,
I need to do transformation with if then else condition..... iam having input column with codes 1,2,3,4,5,6,7
I need to populate the " ab" if the input code 1,2,3 and if it is 4 ,5 then "cd" and if it is 6 ,7 then "ef"
i tried by writing if then else logic for every code. Can you please guide me with simple way of implementing the logic...
If then else logic in transformer
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 89
- Joined: Sat Jul 24, 2010 11:33 pm
The simplest is writing the If Then Else with the output values that are related to less number of input columns.
Code: Select all
If InputColumn = 6 Or InputColumn = 7 Then 'ef' Else If InputColumn = 4 Or InputColumn = 5 Then 'cd' Else 'ab'
Kris
Where's the "Any" key?-Homer Simpson
Where's the "Any" key?-Homer Simpson
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
You can try something like
Alternatively you can try
Code: Select all
If Index('|':yourField : '|', '|1|2|3|') > 0 Then 'ab' Else .......
Code: Select all
If yourField > 5 Then 'ef' Else If yourField > 3 Then 'cd' .......
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
Field("ab|ab|ab|cd|cd|ef|ef", "|", InLink.TheValue, 1)
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.