cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

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.

jyothi_anagani
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Thanks Jyothy,

What is the input parameter???

Thanks,

ss

jyothi_anagani
Active Contributor
0 Kudos

Hi,

Two inpus. First one is type and second one is description. i took it as a, b. a is type. b is description.

Issue resolved or NOT.

Thanks.

Former Member
0 Kudos

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

Former Member
0 Kudos

It is possible in Mapping.Please make the maaping as mentioned below

type----


| |

description--


| UDF|--


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);

jyothi_anagani
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Jyothy,

My required out put like this..

If type = 1,2 and 3

Field1 - Description = Field1[Constant]

Value field = ABC

If type = 4 and 5

Field2 - Description = Field2[Constant]

Value field = DE

Thanks for response..

SS

former_member581827
Participant
0 Kudos

Hi,

Check the value of type1 in mapping if its equal to 1 or 2 or 3 the pass ABC value to field description else pass DE if type 1 value equals to 4 or 5.

Regards,

Chandra.