cancel
Showing results for 
Search instead for 
Did you mean: 

UDF execution - subelement UDF executed before parent element creation

Former Member
0 Kudos


Hello folks,

I have a situation where the value of an element is not getting filled, even though the UDF is being executed correctly. The tricky part is, the mapping for a subelement is executed before the parent element creation, as I see in the trace, which determines if the parent element exists or not.

To be more specific, this is the mapping I'm talking about:

    /DELVRY07/IDOC/E1EDL20/E1ADRM1=createIfExistsAndHasOneOfSuchValues(/ns0:INVOIC98B/M_INVOIC/G_SG2/S_NAD/D_3035,
   
const(value=SE),
    result)
/DELVRY07/IDOC/E1EDL20/E1ADRM1/@SEGMENT=const(value=1)
/DELVRY07/IDOC/E1EDL20/E1ADRM1/PARTNER_Q=const(value=LF)
/DELVRY07/IDOC/E1EDL20/E1ADRM1/PARTNER_ID=assignOneValueByCondition2(removeContexts(/ns0:INVOIC98B/M_INVOIC/G_SG2/S_NAD/D_3035),
   
const(value=SE),

 

When I add some trace messages to determine what is going on during runtime, this is what I get:

Close tag [LIFEX]

starting the createIfExists

Starting the assignOneValueByCondition2

Just before the loop!

Trying a comparison with:BY

comparing:SE, BY

Trying a comparison with:SE

comparing:SE, SE

adding value:1002

Start tag [E1ADRM1]

Add attribute: [SEGMENT]=[1]

Start tag [PARTNER_Q]

Put value [LF]

Close tag [PARTNER_Q]

Close tag [E1ADRM1]

starting the createIfExists

So, as you can see from above, the UDF is adding the correct value, 1002, but the UDF is executed before the element is started:

Start tag [E1ADRM1]

Because of this, I am getting no value in this subelement.

If I add a constant to this PARTNER_ID element, like for the PARTNER_Q, it is correctly mapped.

Additionally, if the parent element is mapped to a constant, the subelement UDF is executed correctly.

Element mapping (basically the constant 1):

    /DELVRY07/IDOC/E1EDL20/E1ADRM1=iF(const(value=1),
   
stringEquals(const(value=1),
   
const(value=1)),
   
createIfExistsAndHasOneOfSuchValues(/ns0:INVOIC98B/M_INVOIC/G_SG2/S_NAD/D_3035,
   
const(value=SE),
    result))

 

Trace result:

Close tag [LIFEX]

starting the createIfExists

Start tag [E1ADRM1]

Add attribute: [SEGMENT]=[1]

Start tag [PARTNER_Q]

Put value [LF]

Close tag [PARTNER_Q]

Starting the assignOneValueByCondition2

Just before the loop!

Trying a comparison with:BY

comparing:SE, BY

Trying a comparison with:SE

comparing:SE, SE

adding value:1002

Start tag [PARTNER_ID]

Put value [1002]

Close tag [PARTNER_ID

I'm completely confused by this and funny enough I haven't experienced this in my previous years of PI.

Useful information for this issue:

We use PO 7.4 with B2B Addon and both UDFs used here are found in an external library and have the execution type "All values of a Queue".

Do you by any chance have any idea on how I could force the execution so that the result of my UDF is correctly added to the sublement? I'm running out of ideas at the moment and the only ones I could think of at the moment as backup plans are suboptimal.

Thanks in advance,

George

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I've solved this by using the context better and not needing UDFs for those subelements.

Answers (0)