cancel
Showing results for 
Search instead for 
Did you mean: 

Xpath Condition - Interface determination

Former Member
0 Kudos

Hi Experts,

I have this xpath condition, however the processing failed.

(/p1:MT_extGoodsReceipt/GoodsReceipt/GoodsReceiptDetail/ListOfGoodsReceiptItemDetail/GoodsReceiptItemDetail/GoodsReceiptLineItemReferences/ListOfReferenceCoded/ReferenceCoded[[ ReferenceTypeCodedOther='LIMIT_VALUE']], EX)

(/p1:MT_extGoodsReceipt/GoodsReceipt/GoodsReceiptDetail/ListOfGoodsReceiptItemDetail/GoodsReceiptItemDetail/GoodsReceiptLineItemReferences/ListOfReferenceCoded/ReferenceCoded[[ ReferenceTypeCodedOther!='LIMIT_VALUE']], EX)

I have one source (xml) and two target idoc interfaces. The target interface is determined based on the defined condition.

The structure of the source has multiple <ReferenceCoded>, for instance:

<ReferenceCoded>

<ReferenceTypeCoded>AA</ReferenceTypeCoded>

<ReferenceCoded>

<ReferenceTypeCoded>Other</ReferenceTypeCoded>

<ReferenceTypeCodedOther>BB</ReferenceTypeCodedOther>

</ReferenceCoded>

<ReferenceCoded>

<ReferenceTypeCoded>Other</ReferenceTypeCoded>

<ReferenceTypeCodedOther>CC</ReferenceTypeCodedOther>

</ReferenceCoded>

<ReferenceCoded>

<ReferenceTypeCoded>Other</ReferenceTypeCoded>

<ReferenceTypeCodedOther>LIMIT_VALUE</ReferenceTypeCodedOther>

</ReferenceCoded>

Since we have LIMIT_VALUE then the condition is TRUE; however the processing fails. Please your advise.

Thank you very much!

Regards,

Lex

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

do not use the bracket

//ReferenceTypeCodedOther='LIMIT_VALUE'  EX)

Regards Mario

Edited by: Mario Müller on Apr 14, 2009 8:22 AM

Former Member
0 Kudos

Hi lex,

You may try this.

1.First receiver give the condition.

(/p1:MT_extGoodsReceipt/GoodsReceipt/GoodsReceiptDetail/ListOfGoodsReceiptItemDetail/GoodsReceiptItemDetail/GoodsReceiptLineItemReferences/ListOfReferenceCoded/ReferenceCoded[ ReferenceTypeCodedOther='LIMIT_VALUE'], EX)

2.The second receiver:

select continue message processing with the following receiver.Give the Business system name or service name.

Regards,

Prakasu.M

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Lex,

Alternatively, you could opt to use multi-mapping. Then as for the conditions, you could make a queue type udf that concats all values of the "referenceTypeCoded", searches for the string "LIMIT_VALUE" and returns a true or false. This in turn activates the type of IDOC you will be using.

Hope this helps,

Regards,

Shabarish_Nair
Active Contributor
0 Kudos

did you check the multiline option in the condition editor?

More on xpath - /people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination

henrique_pinto
Active Contributor
0 Kudos

Hi Lex,

what's your objective?

If there is an <ReferenceCoded> tag with 'LIMIT_VALUE' in the source XML, what should be done?

Just one particular interface should be called? Or you want to split the XML in a way that the tags with the 'LIMIT_VALUE' go to one interface and the other tags go to other interface?

Also, notice that for synchronous interfaces you must have at most one true sentence.

Hence, you need to make sure that one condition is always true and the other is always false.

Regards,

Henrique.

Former Member
0 Kudos

Hi Henrique,

The source xml structure is ...

/extGoodsReceipt/GoodsReceipt/GoodsReceiptDetail/ListOfGoodsReceiptItemDetail/GoodsReceiptItemDetail/GoodsReceiptLineItemReferences/ListOfReferenceCoded/ReferenceCoded/ReferenceTypeCodedOther

Only one target interface is called once the condition is satisfied and no splitting of xml message.

We tried the following xpath condition...

/extGoodsReceipt/GoodsReceipt/GoodsReceiptDetail/ListOfGoodsReceiptItemDetail/GoodsReceiptItemDetail/GoodsReceiptLineItemReferences/ListOfReferenceCoded/ReferenceCoded[ReferenceTypeCodedOther='LIMIT_VALUE'] , EX)

and it works! Once this condition is satisfied, the first target interface is executed

For the second condition, is there a way to negate the whole first condition? Sort of negating the EX operator.

Thanks!

Regards,

Lex

Shabarish_Nair
Active Contributor
0 Kudos

try

/extGoodsReceipt/GoodsReceipt/GoodsReceiptDetail/ListOfGoodsReceiptItemDetail/GoodsReceiptItemDetail/GoodsReceiptLineItemReferences/ListOfReferenceCoded/ReferenceCoded[ReferenceTypeCodedOther!='LIMIT_VALUE'] , EX)

note its != now

Former Member
0 Kudos

Right! "!='LIMIT_VALUE'" should be OK; however two idocs will be generated. We only need to generate one Idoc per xml message - 1source(xml):1target(idoc).

Because in the source XML we might have a scenario that looks like this...

<ReferenceTypeCodedOther>AA</ReferenceTypeCodedOther>

<ReferenceTypeCodedOther>BB</ReferenceTypeCodedOther>

<ReferenceTypeCodedOther>LIMIT_VALUE</ReferenceTypeCodedOther>

Regards,

Lex

henrique_pinto
Active Contributor
0 Kudos

Hi Lex,

Im not really sure if it's possible to negate the EX operator.

The problem about Shabarish's sugestion is that if there're two tags, one with LIMIT_VALUE and one with a different value, this condition will also be true.

So you'll have two true statements, and your requirement won't be met.

You could try to play around with XPath operators, e.g. count() and try to use something like:

count(/x/y[z = 'value']) =/= 0
or
count(/x/y[z = 'value']) = 0

Check this: http://msdn.microsoft.com/en-us/library/ms256103(VS.85).aspx

Best,

Henrique.

Former Member
0 Kudos

Henrique,

Thanks so much for that! Pretty strange though, our xi doesn't take the count condition. But it works in stylus studio. I have played around with the count function in the condition but no luck. Maybe we'll just have to use other criteria for the second condition then.

Regards,

Lex

Shabarish_Nair
Active Contributor
0 Kudos

an alternative i can suggest is option of setting a flag value in the mapping itself.

something like this;

/people/shabarish.vijayakumar/blog/2005/08/03/xpath-to-show-the-path-multiple-receivers

this will give u the flexibility to check all your conditions in the mapping itself.. which is rather easier than the checks in xpath.

henrique_pinto
Active Contributor
0 Kudos

which version of XI do you have?

Maybe it's from XPath 2.0, but XI 3.0 only supports 1.0 I think.

Regs,

Henrique.

Former Member
0 Kudos

Hi Henrique,

The environment is 7.0

These were some of the functions "not()", "string-length()", "count()". However XI is not taking it.

Regards,

Lex