cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a target node having two occurrences with different values or rules for each occurrence

0 Kudos

Hi experts,

I have a requirement where on the target side a particular segment has min and max occurrence 2 and that segment has 5 elements with min occurrence as 1.

The requirement is that, based on a particular logic, 5 elements will be populated and for the same logic the second occurrence will have different values based upon some other conditions.

Please let me know how can I achieve this?

Accepted Solutions (0)

Answers (5)

Answers (5)

0 Kudos

Hi everyone,

Thanks for all  your replies.

But I am not sure if duplicate subtree would suffice my requirement.

It was my fault that I did not give the requirement in details. Let me put it in again.

Name of the target segment is OID_COATING whose occurrence is 2.
This particular segment is having five elements MTLCSURF, CTNGFNCD, MTLCTWTR, MTLCTWMN, MTLCTWMX each of occurrences 0-1.

Now
If <condition 1> is true
//Occurrence 1  -
MTLCSURF(1) := 'A'
CTNGFNCD (1):= COAT_FINISH_INTERNAL + COAT_SURFACE_QUALITY_INTERNAL
MTLCTWTR(1) := : COAT_WGT_SINGLE_TOP_TGT
MTLCTWMX (1):= COAT_WGT_SINGLE_TOP_MAX
MTLCTWMN (1) := COAT_WGT_SINGLE_TOP_MIN

//Occurrence 2   -
MTLCSURF(2) := 'B'
CTNGFNCD (2):= COAT_FINISH_INTERNAL + COAT_SURFACE_QUALITY_INTERNAL
MTLCTWTR(2) := : COAT_WGT_SINGLE_BTM_TGT
MTLCTWMX(2) := COAT_WGT_SINGLE_BTM_MAX
MTLCTWMN(2)   := COAT_WGT_SINGLE_BTM_MIN

Else if <condition2>  is true

//Occurrence 1  -
MTLCSURF(1) := 'A'
CTNGFNCD (1):= COAT_FINISH_INTERNAL + COAT_SURFACE_QUALITY_INTERNAL
MTLCTWTR(1) := : COAT_WGT_TRIPLE_TOP_TGT
MTLCTWMX(1) := COAT_WGT_TRIPLE_TOP_MAX
MTLCTWMN(1)  := COAT_WGT_TRIPLE_TOP_MIN

//Occurrence 2  -
MTLCSURF(2) := 'B'
CTNGFNCD (2):= COAT_FINISH_INTERNAL + COAT_SURFACE_QUALITY_INTERNAL
MTLCTWTR(2) := : COAT_WGT_TRIPLE_BTM_TGT
MTLCTWMX(2) := COAT_WGT_TRIPLE_BTM_MAX
MTLCTWMN(2)  := COAT_WGT_TRIPLE_BTM_MIN

Else if If <condition 3> is true

//Occurrence 1  - 
MTLCSURF(1):= 'C'
CTNGFNCD (1):= COAT_FINISH_INTERNAL + COAT_SURFACE_QUALITY_INTERNAL
MTLCTWTR(1) :=  COAT_WGT_SINGLE_TOT_TGT
MTLCTWMX (1):= COAT_WGT_SINGLE_TOT_MAX 
MTLCTWMN(1)  := COAT_WGT_SINGLE_TOT_MIN

//Occurrence 2 - 
MTLCSURF(2):= “ “
CTNGFNCD (2):= “ “
MTLCTWTR(2) :=  “ “
MTLCTWMX (2):= “ “
MTLCTWMN(2)  := “ “

Else  If <condition 4> is true

//Occurrence 1  - 
MTLCSURF(1):= 'C'
CTNGFNCD (1):= COAT_FINISH_INTERNAL + COAT_SURFACE_QUALITY_INTERNAL
MTLCTWTR(1) :=  COAT_WGT_TRIPLE_TOT_TGT
MTLCTWMX (1):= COAT_WGT_TRIPLE_TOT_MAX 
MTLCTWMN(1)  := COAT_WGT_TRIPLE_TOT_MIN

//Occurrence 2 - 
MTLCSURF(2):= “ “
CTNGFNCD (2):= “ “
MTLCTWTR(2) :=  “ “
MTLCTWMX (2):= “ “
MTLCTWMN(2)  := “ “

All the values written like "COAT_FINISH_INTERNAL", "COAT_WGT_TRIPLE_TOT_MIN" are the property values which have to be matched and derieved based on some other logic. We can ignore that part now.

Would wait for your replies.

ambrish_mishra
Active Contributor
0 Kudos

Use duplicate subtree 7 times so that you have 8 OID_COATING segments in the target. Use the conditions as per your logic above. You have 4 conditions and each condition would apply on 2 segments each.

I don't see an issue. But by principle, the conditions should satisfy such that OID_COATING segment is created maximum 2 times.

Cheers

Ambrish

Former Member
0 Kudos

Hi Subhra

Please create your mapping like below

write an generice UDF for populating the strcuture

code:

if (cond[0].equals(""))
{
result.addValue("");
result.addValue("");
}

if (cond[0].equals("1"))
{
result.addValue(input1[0]);
result.addValue(input2[0]);
}

if (cond[0].equals("2"))
{
result.addValue(input1[0]);
result.addValue(input2[0]);
}

if (cond[0].equals("3"))
{
result.addValue(input1[0]);
result.addValue(input2[0]);
}

if (cond[0].equals("4"))
{
result.addValue(input1[0]);
result.addValue(input2[0]);
}

The root node will be mapped like below

Then map your fields like below

in the fixed value put the value for input as 1

in the fixed value put the value for input as 2

Similary map the other fields

fixed values will be

input1 :

input 2:

similarly map the rest fields

Output:

Let me know if you have any doubts.

Former Member
0 Kudos

Hi,

Easy, in message mapping, just duplicate the segment !  See option of contextual menu on your target segment So by this way, you have:

     Segment_1

     Segment_1(1)   1st duplication of Segment_1.

regards

Mickael

ambrish_mishra
Active Contributor
0 Kudos

Use duplicate subtree and create them once each based on different conditions,,, same for fields in the node.

Hope it helps!

Ambrish

manigram
Active Participant
0 Kudos

Hi ,

Please share your conditions, on what basis the target element have to populate.

Regards,

Manigandan

Former Member
0 Kudos

Hello,

Not sure if i understood u correctly, but why don't u use Duplicate Subtree for the target segment and populate different values inside the elements?

Thanks

Amit Srivastava