Transformer derivation

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
scorpion
Participant
Posts: 144
Joined: Thu May 12, 2005 4:19 am

Transformer derivation

Post by scorpion »

Hi All,

I need to write some derivation in my transformer like below:

if sourcecolumn1= 300 or 300% then populate 'xx'else blank.

my intension is, if the values are in source like 300 or 30045 or 30076 or 30088etc,whatever starts with 300 i need to populate as 'XX'.

SO below logic will work
IF sourcecolumn1='300%'then 'XX'else ''

?(will this look exactly for 300% or any thing starts with 300?)

can any one help me on this?
Thanx&Regards
scorpion
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

Convert the values to string and get the first 3 characters using substring. Compare them using CompareNoCase(%string1%,%string2%) function in transformer.
scorpion
Participant
Posts: 144
Joined: Thu May 12, 2005 4:19 am

Post by scorpion »

Hi Maveric Thanks for the reply,

It is very usefull forme,if you help me by giving exact derivation to me.
Thanx&Regards
scorpion
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

You need to declare the sourcecolumn1 as varchar. Conversion from int to varchar will be implicit. so dont have to worry abt it.

IF CompareNoCase(sourcecolumn1[1,3],300) then 'XX 'else ''
scorpion
Participant
Posts: 144
Joined: Thu May 12, 2005 4:19 am

Post by scorpion »

Hi,

Will Left function work in my scenario(means for integer type)?
Left((inputcolumn), 3)="700" or
Left((inputcolumn), 3)="701"
Thanx&Regards
scorpion
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

You will have to tell me. Did u try it? What other options have you tried?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Left() is a string function and [] (substring operator) is a string operator - you would need to convert the integer to a string to be able to use either Left() or [substring] notation.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply