Skip to Content
0

Need help with UDF PI

Sep 26, 2017 at 11:09 AM

85

avatar image

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

capture.jpg (58.8 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Mark Dihiansan Sep 27, 2017 at 09:26 AM
1

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


split1.png (19.2 kB)
split2.png (23.1 kB)
join.png (15.8 kB)
map1.png (32.0 kB)
map2.png (17.3 kB)
map3.png (36.2 kB)
test.png (42.7 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks Mark.

0
Raghuraman S Sep 26, 2017 at 12:00 PM
2

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]);
}
}
}


capture.png (16.4 kB)
1.png (15.6 kB)
kkrpi.png (33.7 kB)
capture.png (31.2 kB)
Show 7 Share
10 |10000 characters needed characters left characters exceeded

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.

capture.jpg (69.4 kB)
0

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.

0

Hi Ragu,

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

this is where I am stuck.

capture.jpg (121.0 kB)
0

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:

capture1.png (14.9 kB)
capture2.png (75.6 kB)
0

Thanks Raghu.

1

it Worked Senthil?

0

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 :)

capture.jpg (63.6 kB)
0