on 04-22-2009 12:26 AM
Hi all,
I have mapping issue...
My requirement is...
Source structure
Material Description [0..unbound]
Type [1..1]
Desecration [1..1]
Target Structure
Field1 [0..1]
Description [1..1]
Value [1..1]
Field2 [0..1]
Desecration [1..1]
Value [1..1]
From Source we are getting the 5 time
Type 1,2,3,4, and 5.
Description also we are getting respectively..
Means
type 1, Description A
type 2, Description B
type 3, Description C
type 4, Description D
type 5, Description E
If type = 1,2 and 3
Field1 - Description field we are sending constant value.
Value field - Type1 Description + Type2 Description + Type3 Description
If type = 4 and 5
Field2 - Description field we are sending constant value.
Value field - Type3 Description + Type4 Description
If not possible, Please give me the UDF code.
Thanks
SS
Hi
I have tested the below Message Mapping Please try this out it is working fine for ur req as u have mentioned
<h5>TestField UDF</h5>
boolean flag1= false,flag2= false;
for(int i=0;i<type.length;i++)
{
if(type<i>.equals("1") ||type<i>.equals("2")||type<i>.equals("3") )
flag1 = true;
else if(type<i>.equals("4") ||type<i>.equals("5"))
flag2= true;
}
if(flag1)
result.addValue("Field1");
if(flag2)
result.addValue("Field2");
<h5> getField1Desc UDF</h5>
String output1="";
for(int i=0;i<type.length;i++)
{
if(type<i>.equals("1") ||type<i>.equals("2")||type<i>.equals("3") )
output1=output1+desc<i>;
}
result.addValue(output1);
<h5> getField2Desc UDF</h5>
String output1="";
for(int i=0;i<type.length;i++)
{
if(type<i>.equals("4") ||type<i>.equals("5") )
output1=output1+desc<i>;
}
result.addValue(output1);
<h5> Mesage Mapping should be as given below</h5>
type----------------------------------------TestField------equals------------Field1
(change Context to root node) constant(Field1)
type--removeContext---getField1Desc------value
|
desc--removeContext--|
type--removeContext---getField2Desc------value
|
desc--removeContext--|
Thank You.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
for 1st UDF
String s = " " ;
for( int i=0;i<a.length&&i<b.length;i++)
{
if (a<i>.equals("'1") || a<i>.equals("'2") || a<i>.equals("'3"))
{
s.concat(b<i>);
}
}
result.addValue(s);
for second UDF
String s = " " ;
for( int i=0;i<a.length&&i<b.length;i++)
{
if (a<i>.equals("'4") || a<i>.equals("'5") )
{
s.concat(b<i>);
}
}
result.addValue(s);
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try this
While mapping Field1->Value, use this UDF.
for(int i=0;i<typ.length;i++)
{
if ( typ<i>.equals("1") || typ<i>.equals("2") || typ<i>.equals("3") )
str = str + des<i>;
}
result.addValue(str).
To map Field2->Value, use this UDF.
for(int i=0;i<typ.length;i++)
{
if ( typ<i>.equals("4") || typ<i>.equals("5") )
str = str + des<i>;
}
result.addValue(str).
Thanks,
Ravi.
Edited by: P.Ravi Varma on Apr 22, 2009 11:01 AM
Edited by: P.Ravi Varma on Apr 22, 2009 11:01 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is possible in Mapping.Please make the maaping as mentioned below
type----
| |
description--
OUTPUT
constant(field1)----
| |
Do the same mapping for the field 2 also whare constant would be field 2
then use the below UDF
String output="";
String output1="";
for(int i=0;i<type.length;i++)
{
if(desc<i>.equals("1")||desc<i>.equals("2")||desc<i>.equals("3"))
output=output+desc<i>;
else
output1=output1+desc<i>;
}
if(Input[0].equals("field1"))
result.addValue(output);
else
result.addValue(output1);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can you be more clear What is your required output.
What should be there in decsciption field of target.
send me the required output.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.