cancel
Showing results for 
Search instead for 
Did you mean: 

regarding mapping requirement

Former Member
0 Kudos

Hi All,

i have one requirement,

Assuming the attached example, with 3 ShipUnits((SU1,SU2,SU3) Segments at sender side:

·         SU 1 has pallet type: Xid=BULK_TANKER and ShipUnitCount=1

·         SU 2 has pallet type: Xid=BULK_TANKER and ShipUnitCount=2

·         SU 3 has pallet type: Xid=ULE_EURO_PALLET and ShipUnitCount=5

(based on Xid  unique value we need to create

                                                               we should have 2 package total segments)   

SenderSide structure:--

SU 1 (occu=0:unbound)                                                       

     Xid=BULK_TANKER (1:1)

     ShipUnitCount=1(1:1)                             

SU 2 (occu=0:unbound)                                                                                                                              

      Xid=BULK_TANKER (1:1)                                                                                                                         

      ShipUnitCount=2(1:1)                                                                                                                                  

SU 3 (occu=0:unbound)                                                                                                                          

     Xid=ULE_EURO_PALLET (1:1)

     ShipUnitCount=5(1:1)


OutPut:---

   package total (0:unbound)

         TotalPackageQuantity =3(0:1)   

package total (0:unbound)

        TotalPackageQuantity =5 (0:1)

Xid---->RemoveContext---->SplitByValue(valuechange)--->CollapseContext-->Exists-->Createif--> package total

the above logic creating two segments ok fine but i want to  add  all ShipunitCount field values(1+2=3) for corresponding  Xid= BULK_TANKER

and pass    to   TotalPackageQuantity =3 under the first segment package total 1

and    if  Xid= ULE_EURO_PALLET  this corresponding ShipunitCount field value(5) i need to pass to  TotalPackageQuantity =5 under the second segment.



Target side:----

In the output, we should have 2 package total segments:

·         1 for BULK_TANKER with TotalPackageQuantity 3-------> I need to add ShipUnitCount field values  1+2=3   so outpu

totalPackageQuantity =3

·         1 for ULE_EURO_PALLET with TotalPackageQuantity 5----->

I need to get  ShipUnitCount field value 5 so outputt   : totalPackageQuantity =3

OutPut:---

   package total 1(0:unbound)

        TotalPackageQuantity =3(0:1)   

package total 2(0:unbound)

        TotalPackageQuantity =5 (0:1)


any UDF required plz help me or based on sort by key we need to fetch values if it is possible?

Requirement:---

Group all ShipUnits for each Pallet type(BULK_TANKER ,ULE_EURO_PALLET)

Xid= and

copy sum of all ShipUnitCount

So based on for each different Xid value i need to add the ShipUnitCount values under the ShipUnit 2 sender Segments coming for  same pallet type  BULK_TANKER but shipunitcount  values are different ,so 

I need to add ShipUnitCount field values  1+2=3 so outpu

totalPackageQuantity =3

Please send me the mapping logic  or we need to use any udf   please send me udf logic 

Thanks,

Aadi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Aadi,

Can you please try this. I think we dont need a UDF. I have considered sorting as there are possibilities where xid come in different order.

Mapping for packagetotal

Keep the context of xid to higher level, or use remove context after it

Mapping for TotalPackageQuantity

Keep the context of xid to higher lever, or use remove context after it

Keep the context of ShipUnitCount to higher lever, or use remove context after it

Regards,

Malini

Answers (2)

Answers (2)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Can you do this mapping?

SHIP_UNIT_COUNT-> removeContext -------------------> formatByExample ----->sum ->Target node

BULK_TANKER -> removeContext -> splitByValue(valueChanged) -> /

Hope this helps,

Mark

Former Member
0 Kudos

Hi Aadi,

Please try this:

I have not added the logic for sort.

Please create UDF (Title in above case) with type context and below code:

int j =  0;

for (int i = 0; i < var1.length; i++)

{
   j = j + Integer.parseInt(var1[i]);
}

result.addValue("" + j);

Thanks,

Beena