views:

44

answers:

1

Hi suppose I have the following Source Table (called S)

Table S:

name Gender Code

Bob 0
Nancy 1
Ruth 1
David 0

And let assume I also have the a lookup values table (called S_gender_values)

Gender_Code Gender_value

0 Male
1 Female

My goal is to create a target table (lets call it T) which will look like this.

name Gender_Code

Bob M
Nancy F
Ruth F
David M

I also assume that I have a lookup table foe table T -called T_GenderValues, which I can use in order to create table T (and validates its results)

Gender_Code Gender_value

M Male
F Female

I thought about 2 (or 3) alternatives:

Alternative 1: create a mapping table (lets call it it S_T_Gender_Code_Mapping) which will look like this:

S_Gender_Code T_Gender_code

0 M
1 F

and then do a simple join/lookupo using tMap

Alternative 2: use tMap and add expression which will implement the mapping something like: (S.Gender_Code==0)?"F":"M"

Alternative 3: similar to Alternative 2 but to use user Java routines.

Is there other alternative ? I hoped I could leverage the ease of tMap to map between S_GenderValues and T_GenderValues and to benefit fro the usability of UI tool like we have in tMap

Any hint ?

-- Yonatan

+1  A: 

To me, it seems option #1 is needlessly complex and could slow the process. Sure, if you had dozens or thousands of lookups, that's what you'd want, but not for two.

And option #3 is also too much, as you're going to want to merge the value into a flow or iterate stream anyway (components like tJavaRow are there to make more complex transformations).

The tMap component can do the simple one-line Java right in the flow, so option 2 sounds to me like your best choice.

ewall