cancel
Showing results for 
Search instead for 
Did you mean: 

XPATH Expresstion

Former Member
0 Kudos

My scenario is File to File. Iam having two message mappings with the same source and target. Depending upon the input value the mapping have to be invoked.

Ex: If the input is AR99 means i want only 99 and check it with a input field and the respective mapping should be invoked nad if it is not eqal to 99 means the other mapping should be invoked.

I have tried it by giving the condition as XPATH expression in the Interface Determination but even the input is correct the wrong mapping is being invoked.

I have to use substring for getting the last two values 99 alone from AR99.

So please give me a solution for this.

The conditions we have checked are

/p1:Test/[substring(/p1:Test/Code,3)]

substring(/p1:MT_Test/Code,3,2)

Accepted Solutions (1)

Accepted Solutions (1)

former_member859847
Active Contributor
0 Kudos

Hi bub loo,

substring functionality is used in the message mapping.

Assume source data type has field field1 which has the value 99.

then x-path condition is like this.

/p1:MT_Test/field1=99.

now it will triger the two mapping programs in interface determination.

based on the value of field1.

otherthan this, if u want any info let us know.

Regards

mahesh.

Former Member
0 Kudos

Let us consider that the input field is Code and the outfiled is also code.

If i pass AR99 as input means i need the same value as output. But they should be targetted to the exact mapping depending on the condition.If the input is 99 means Mapping 1 if it is not 99 means mapping 2 should be invoked.

So i need to get the input as it is in the output but the appropriate mapping should be invoked , please help me in this.

Former Member
0 Kudos

Hi bub loo,

The Input values for field Code will not be affetced with your conditinal chack for 99.

Lets have the steps to do this,

Input_Message have the field Code

Now you need Target_Message1 and Target_Message2 (for both you can use the same data type or you can use same message type in mapping. For clarification I have used Target_Message1 & Target_Message2.)

Target_Message1 have field A

Target_Message2 have field A

Now in mapping check,

Mapping for Target_Message1 having field A

Code --> substr(2,2) i.e. 99 ---> equals to 99 --->(true) --> pass it to Target_Message1- A

Mapping for Target_Message1 having field B

Code --> substr(2,2) i.e. 99 ---> equals to 99 --->(False) --> pass it to Target_Message1- A

Thanks

Swarup

Former Member
0 Kudos

Hello Swarup,

Actually i have two different message mappings with the same source and target. So if the input is 99 means like AR99 then mapping one should be executed otherwise if it is AR94 means then Mapping 2 should be invoked. Please give me a solution for this,,

Former Member
0 Kudos

Hi bubloo,

I suggest you can solve using a BPM for this issue, In the BPM you can have a Receive step followed by a switch case which would keep the condition using the XPATH on the required field. If the condition passes you can have the upper branched mapped with your Mapping1 else the message will take the other path in which you could specify the Mapping2 to be picked.

Let me know your thoughts on this.

Regards

Yugandhar K

Former Member
0 Kudos

Hi,

In interfce mapping you could add multiple message mappings.

In mapping1 you add the condition that if

Code --> Substr --> equals to 99 then pass all the field values to target node..here the situation will not work then the target node will not be created .(Occurance should be 0..1)

It will by default execute the another mapping-2 where we can add the check in mapping if code not equals to 99 then pass on the vales to target node.

You could try this option.

Thanks

Swarup

Former Member
0 Kudos

Hello Swarup,

I tried wat u said but iam getting this error

Cannot produce target element /ns0:Test1. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd

So please tell any idea.

Then as per the requirement no BPM should be used , so please give me anyother solutions for this.

Answers (3)

Answers (3)

Former Member
0 Kudos

thank you

santhosh_sontha2
Explorer
0 Kudos

Hi Bubloo,

One of the solution to your problem is in message mapping for target message you add your message type two times. So now you are having two target message types. For first message i.e node message1 you give the condition as:

as: substring(/p1:MT_Test/Code,3,2) equals 99=> createif=>message1.

for the second message i.e for node message2 u give the condition as

substring(/p1:MT_Test/Code,3,2) not equals 99=> createif=>message2.

here createif is a node function.

after that you do mapping for message1 and message 2 based on your requirement.

Regards,

Santhosh

Former Member
0 Kudos

Hi,

You can add two target messages in mapping instead of doing it with XPATH.

If the field value is 99 then 1st message mapping will work and in other case second message mapping will work.

You need to add two target messages in the Messaes tab of the Message Mapping screen.

The mapping of the fields can be conditional based on the input values

Thanks

Swarup