on 08-13-2007 2:41 PM
Hi all,
In my mapping; in source message type one field called f1 and in target message type another field called f2. f1 should be mapped to f2 in such a way as below....
if f1 = 4 then f2 = A
else if f1 = 1 then f2 = B
else if f1 = 0 then f2 = C.
What should I do for this.Are there any mapping logics available for this?
Can anybody pleaseeee.........
Thanks & Regards,
Radhika.
Radhika,
Either you can use Value Mapping or Fix Value Mapping.
Simplest way would be use function "FixValues" under category Converions.
If you double click on the the function it will ask you for Key and corresponding value...in key you can put 1,2,3.....and value would be mapping value. i.e. A,B,C...
Let me know if you needmore details.
Nilesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Radhika,
You can use user defined function for this, code is as below
String b;
if(a.equals("4"))
return b= "A";
else if (a.equals("1"))
return b="B";
else if (a.equals("0"))
return b="C";
else return a;
you can copy & paste in your user defined fn., map it with your source & target field
it will work as you expect.
Regards,
Sakthi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Radhika,
Choose any one of the pattern from the below links.
Pattern1
http://www.flickr.com/photo_zoom.gne?id=1138043932&size=o
Pattern2
http://www.flickr.com/photo_zoom.gne?id=1138043938&size=o
Best regards,
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi radhika,
As all said u approach in that way but we have a flexibilty to write user defined functions .so I sugget you to go for UDF in that write the switch --case it works fine no need for complex mappings.
Reward if useful,
Srinivas.D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Radhika !
And another alternative to what Nilesh proposes is if you need to translate a lot of values or they could change with some frequency, you could use the ValueMapping function that uses values entered in Configuration to map values..this avoids to make transports of repository objects once you are in production environment.
Regards,
Matias.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Radhika !
You should use the If-Then-Else function and some constants to create the "A","B" and "C" values for the target, and for comparing f1 values. Also the equalS function to compare the f1 source field with a constant value.
You will need to use 2 if-then-else functions of graphical mapping.
This function has 3 inputs and 1 output. The inputs are
1) a boolean value
2) a value that goes to the output when 1) is true
3) a value that goes to the output when 1) is false
the equalS function returns true if the 2 input strings are equal. Use this function to compare f1 with the constant values and use the output of this function as input for the if-then-else function.
If you have any question, please ask.
Regards,
Matias.
Message was edited by:
Matias Denker
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Radhika !
You should use "equalS" to compare the content of "f1" with the constant "4"..this function will return "true" if content of "f1" is "4" and false if it is not. This boolean output is what you should use as input for the "if-then-else" function, because this later function only accepts boolean input or "0"/"1".
Regards,
Matias.
Hi Radhika !
This is one of the patterns.
http://img443.imageshack.us/img443/6155/drawing1cau0.jpg
Regards,
Matias.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.