cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with UDF PI

sendhil_kumar
Active Participant
0 Kudos

Hi All,

Can you please help me with the Mapping for below requirement.

Idoc has multiple E1EDP01 segments

  1. E1EDP01
  2. --> E1EDPT1 (TDID - Z005)
  3. --> E1EDPT2 -> TDLINE - Value1#Value2#Value3
  4. --> E1EDPT2 -> TDLINE - Value1#Value2#Value3

I have to take the E1EDPT2 TDLINE and split the values as

Value1 -> Target1

Value2 -> Target2

Value3 -> Target3

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor

Hi,

Can you try this one? There are three UDFs, two splitters and one for joining

split 1

split 2 has three result values

join UDF

Here's the mapping

E1EDP01 --> Header

TEDIOptionList_Details, concat is using pipe "|" as its delimiter

context of TDLINE set to E1EDPT1

Mapping for OptionName_, Choice_ and ChoiceCode_

TDLINE and TDID context same as the two previous mappings.

Test:

Regards,

Mark

sendhil_kumar
Active Participant
0 Kudos

Thanks Mark.

Answers (1)

Answers (1)

former_member186851
Active Contributor

Try the below UDF.

if(var1[0].equals("Z005"))
{
for(int j=0;j<var1.length;j++)
{
String s[]=var1[j].split("#");
for(int i=0;i<s.length;i++)
{
result.addValue(s[i]);
}
}
}

sendhil_kumar
Active Participant
0 Kudos

Hi Raghu,

Thanks for the quick update. I would need to generate the details as per the number of E1EDPT2 segments.

Target Strurcture

E1EDP01 --> Header

EiEDP01-EIEDPT2-TDLINE -> Details->Field1 - Field2 - Field 3.

Multiple E1EDPT2 should generate equal number of Details under each header.

Can you check this and help me with this.

former_member186851
Active Contributor
0 Kudos

Hello Sendhil,

Just map E1EDPT1 to details and try,You should change the context to E1EDP01.

If you can provide the sample XML and target XSD I shall try once.

For Root node may be you can try a simple UDF like below.

String out="test";
if(var1.equals("Z005"))
{
out="";
}
return out;

This will create details for only when E1EDPT2 TDline equals Z005.

sendhil_kumar
Active Participant
0 Kudos

Hi Ragu,

E1EDPT1 is one and the E1EDPT2 is multiple, it is messing up with the context.

this is where I am stuck.

former_member186851
Active Contributor
0 Kudos

Hello Senthil,

Then try with Use one as many followed by UDF as below(Ensure all the nodes are having the context as E1EDPT1).

UDF Calculate:

for(int j=0;j<var1.length;j++)
{
String s[]=var1[j].split("#");
for(int i=0;i<s.length;i++)
{
result.addValue(s[i]);
}
}

Output Generated:

sendhil_kumar
Active Participant

Thanks Raghu.

former_member186851
Active Contributor
0 Kudos

it Worked Senthil?

sendhil_kumar
Active Participant
0 Kudos

I tried some thing different on this. I followed Sunil's Blog and played around the target structure.

Message Mapping : Play around with target structure

and this worked.

Ignore the split at "$" that was to split the different TDLines as per my logic

Really appreciate your quick help on this. I did try your solution and I was stuck around sending the split values to different fields. Thanks 🙂