cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue

Former Member
0 Kudos

Hello,

There is a situation where I need to multiply the value of an EDI field D_6060 under segment C_C186 under S_QTY with the same field value of D_6060 of second occurance of S_QTY and map the result to an output IDOC field.

The structure of the EDI source file is shown below:

LIST u2013 1....1 (root node)

S_UNB u2013 1....1

S_UNH u2013 1....unbounded

G_SSG25 u2013 0....200000

S_LIN u2013 1....1

S_QTY u2013 0...10

C_C186 u2013 1...1

D_6063 u2013 1...1 (xsd:string)

D_6060 u2013 1...1 (xsd:decimal)

D_6411 u2013 0...1 (xsd:string)

Any suggestions will be highly appreciated.

Thanks,

Subhajit.

Accepted Solutions (1)

Accepted Solutions (1)

former_member181962
Active Contributor
0 Kudos

Hi Subhajit,

If it is always a multiplication of the first two occurances of D_6060 field under S_QTY, you can write a small UDF to meet your requirement.

Input: D_6060 (After removing Contexts , Use removeContext function)

UDF type , chose as Queue.

Pseudo Code:

* Declare two int type variables to get the first and second value of the D_6060

v_first = D_6060[0];
v_second = D_6060[1].
v_result = v_first*v_second.
* Convert the int type v_result into string type v_result_str
result.addValue(v_result_str).

Regards,

Ravi

Former Member
0 Kudos

Hi

You can try this

Use D660>> RemoveContext>> UDF

UDF


int iresult = 0 ;
 if (List.length >1) {
  int Val01 = Integer.parseInt(List[0]);
  int Val02 =  Integer.parseInt(List[1]);
  iresult = Val01 * Val02;
}
 else {
  iresult = Integer.parseInt(List[0]);
}
 result.addValue(iresult); 

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Give a try :

Use the u201CIndexu201D for S_QTY and map "index" and "constant= 2" to u201CequalsAu201D pass this to if of u201Cif thenu201D, for then map D_6060, map the output of "if then" to the target field.

Regards,

Venu V

Former Member
0 Kudos

Hi,

Use standard function useOneUsMany.

1st parameter = D_6060;

2nd = S_QTY

3rd = S_QTY

Regards

Ivan