cancel
Showing results for 
Search instead for 
Did you mean: 

Java or Design Mapping Problem

Former Member
0 Kudos

HI,

i have a mapping problem and dont know how to built that.

I have 2 Fields (F1 and F2 in segment SEG_F) and a segment to create called (SEG1).

a) IF F1 and F2 filled than create (createif) SEG1.

b) IF F1 or F2 filled than create (createif) SEG1.

example:

F1 and F2 = filled ---> 2 times SEG1 needed be to created

F1 or F2 = filled ---> 1 time SEG1 needed be to created

any ideas to map that with the own defined functions or only design mapping ?

Thank You,

Gordon

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi !

I would create an advanced java user defined function, with Cache = context, that receives 2 parameters, that is F1 and F2, and then you could do something like this:

public void test(String[] F1, String[] F2,ResultList result,Container container){

if ( !F1.equals("") && !F2.equals(""))

{

result.addValue("");

result.addValue("");

}

else if ( !F1.equals("") || !F2.equals(""))

{

result.addValue("");

}

else

{

result.addValue(ResultList.SUPPRESS); //to avoid SEG1 creation.

}

}

obviously this can be optimized...

then you use F1 and F2 fields as input fields and SEG1 as target (it is a root node..am I right?) with the "", it should create the segment 1 or 2 times depending on the condition. For filling fields under SEG1, you maybe would need to use the UseOneAsMany.

hope it helps.

Matias

STALANKI
Active Contributor
0 Kudos

Use If then and exist combo and Createif in conjunction the graphical mapping will be taking care of occurrences.

For you to master the message mapping read these blog that will definetly help you:

/people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i

/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

There is the standard function "EXISTS" , would it not solve the issue?

In the target SEG1 , right click on it and say duplicate SUbtree and now add the 2 separate conditions to it using EXISTS.

Regards

Bhavesh