on 11-13-2013 11:27 AM
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?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use duplicate subtree and create them once each based on different conditions,,, same for fields in the node.
Hope it helps!
Ambrish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Please share your conditions, on what basis the target element have to populate.
Regards,
Manigandan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
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.