cancel
Showing results for 
Search instead for 
Did you mean: 

graphical message mapping query

former_member183906
Active Contributor
0 Kudos

Hi,

Source message node SRC1,SRC2
Target message node TAR1

If SRC1 value is "state", then SRC2 value should go to TAR1.

how to achieve it. Which standard function shall i use in PI message mapping for it. I need to use graphical mapping for it.

Regards

Accepted Solutions (1)

Accepted Solutions (1)

former_member183906
Active Contributor
0 Kudos

SOURCE STRUCTURE :

<Hi>
                    <S SRC1="1">
                        <TAR1>xyz</TAR1>
                    </S>
                    <S SRC1="2">
                        <TAR1>oiu</TAR1>
                    </S>
      <S SRC1="3">
                        <TAR1>state</TAR1>
                    </S>
     <S SRC1="4">
                        <TAR1>ghj</TAR1>
                    </S>
</Hi>

After graphical mapping output shud be :


Output shud be

<Hi>
<S SRC1="3">
                        <TAR1>state</TAR1>
</Hi>

Any help in it..

former_member556603
Active Contributor
0 Kudos

Hi PI,

Use ifWithoutElse function.  

IF SCR1 is equals to "state" Then Pass SCR2. After that change your Context or Use Remove context and mapped to the Target Filed.

Thanks,

Maruthi.

Muniyappan
Active Contributor
0 Kudos

Hi SAP,

there is no field called SRC2  in you input xml file.

and SRC1 is not having value "state" either.

i have created mapping based on your input xml file. please check.

do the logic for node S and one to one mapping for SRC1 and TAR1.

mapping test results

please let me know if i did not get you correct.

Regards,

Muniyappan.

Answers (3)

Answers (3)

former_member184789
Active Contributor
0 Kudos
former_member183906
Active Contributor
0 Kudos

using it,

the target node - display queue is coming like this

but i need only id11 in target element.so its giving error. how to get only id11 in target element

Former Member
0 Kudos

Hello,

Use removecontext just before ur target node...

Thanks

Amit Srivastava

Muniyappan
Active Contributor
0 Kudos

Hi SAP,

if possible can you share input and output xml which can give us more idea.

SRC1,SRC2,TAR1 these are nodes or fields?

nodes you can not store values(if you are not having attributes) correct me if am wrong.

Regards,

Muniyappan.

Former Member
0 Kudos

Hi

if you get only one message in the source structure then you can use remove context but if you get multiple message in the source structure then remove context is not a good option.

write the below UDF

for(int index=0; index< a.length; index++){

if(a[index] != ResultList.SUPPRESS){

  result.addValue(a[index]);

}

}

Cheers

Hidayat

Former Member
0 Kudos

Hi,

You have IF boolen and equalsS string functions in graphical mapping to achieve this.

IF SRC1 equalsS to "state"(define this as constant) THEN

Asign SRC2 to target field TAR1.

Let me know if you want screen shot of it. Above logic ll solve your query.

Thanks,

Rajendra

former_member183906
Active Contributor
0 Kudos

can u pls send screenshot of it

Former Member
0 Kudos

Hi,

Here is a screen shot, hope it will help you.

Thanks,

Rajendra

former_member183906
Active Contributor
0 Kudos

I have shared source and target message below few posts-

I have done this mapping. It works when SRC1 element is having one value state.

but,if in XML ,SRC1 is having more than 1 value like state,count etc - then it fails -"

        Values missing in queue context. Target XSD requires a value for this
        element, but the target-field mapping does not create one. Check
        whether the XML instance is valid for the source XSD, and whether the
        target-field mapping fulfils the requirement of the target XSD

  "

can u help in it

Former Member
0 Kudos

Hi,

In case of multiple values in the source side(state,count etc), that time first you should map the TargetNode (as shown below) and then value the taget field. For node and field mapping logic is same but for field there extra 'splitByValue' function. Here is screen shots, it ll help you.

rajasekhar_reddy14
Active Contributor
0 Kudos

use standard if else mapping function to achive it. very simple.