cancel
Showing results for 
Search instead for 
Did you mean: 

Need UDF for the following requirement

Former Member
0 Kudos

Hello All,
    I have the following requiremnt in  SAP PI. Could you please help me in writing the UDF.
For example i have source field contains value 1 in the field. Also next if the same value 1 comes in the field of next node the out put should be incremented by 1. Here are the following in detail.

Source side                                                                                                     Target side
Node1                                                                                                              Node1
  A=1                                                                                                                 A=1
Node 2                                                                                                             Node 2
A=1                                                                                                                    A=2
Node 3                                                                                                             Node 3
A=2                                                                                                                     A=1
Node 4                                                                                                             Node 4
A=2                                                                                                                    A=2                                   
Node5                                                                                                              Node5
A=2                                                                                                                      A=3
Node6                                                                                                                Node6
A=3                                                                                                                       A=1
Node7                                                                                                                 Node7                                                                                                           
A=4                                                                                                                    A=1

That means if the same value gets repeateed in source side for different nodes, the output gets incremented by one. And if the different value comes in source side for different nodes. The output will be 1.

Thanks in advance for help....  :):)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

I think u can use graphical mapping to achieve ur requirement.

BTW, i believe by next node u mean next instance of the same node? right?

If my assumption is true, then u can check below mapping (in case ur input values are not sorted then u can use sort function also):

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi Amit,

     Thank you so much for the help. Just to clarify, yes the same node it comes next time in the target side. Also where is the incrementation done here i mean if the same value comes it should increase by 1 in the next instance of same node. Could you please help me on this and clarify me..

Thanks alot in advance:):)

Former Member
0 Kudos

Hello,

Yes, index function (and mapping) will take care of incrementing the value by 1 for the same type of values.

Just test the mapping and let me know in case of any issues.

Thanks

Amit Srivastava

Former Member
0 Kudos

Hey Amit,

    

     Really thanks alot for your great help. It is absolutely working fine as expected. Stil in case of aany changes in the requriment i wil contact you. Thanks alot again...

Answers (0)