cancel
Showing results for 
Search instead for 
Did you mean: 

Count fields in Mapping

sherin_jose4
Participant
0 Kudos

Hi all,

We are using PI7.0, we have a requirement where we need to count the number of fields occurring in the target and that count has to be given in one of the field. The target elements vary according to the input. To be clear, for example

If 5 fields are formed in the target, the 5th field should have the number 5 as the output.

Can this be achieved in message mapping ?

If so, kindly help me .

Regards,

Sherin Jose

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member193376
Active Contributor
0 Kudos

You can use a UDF, have a global variable as a counter and use it in your UDF to count the occurances.. Ideally its possible to do it with graphical functions.

THanks

S

srikanth_srinivasan3
Active Participant
0 Kudos

Hi

Create a global variable under the parent segment & map counter funtion to it.

You can map this global variable to which ever field u want to.

-

Srikanth Srinivasan

Former Member
0 Kudos

>> Can this be achieved in message mapping ?

Yes... Use index function as sugested by Stefan

Regards,

Abid

sherin_jose4
Participant
0 Kudos

How will that work ? Help me how i can achieve by using that.

Index function is used to find the position in a string right. Correct me if i am wrong.

My requirement is,

I have 10 fields in source and 10 fields in target. Based on the input the number of fields formed at the target may vary. What i exactly need is that when 8 fields are formed in the target in that structure, a field in that structure should have the number of fields that were formed in the target.

Source Target values

FirstName Name Raghu

EmpNo ID 005

Salary pay 12000

Fields Field 4

As highlighted, the fourth field should say the number of occurrences of the target fields. I need to know how i can get the last field dynamically when the target is formed.

Regards,

Sherin Jose

Former Member
0 Kudos

Hi,

Did u chk the "index" under Statistic??

/people/stefan.grube/blog/2005/12/29/new-functions-in-the-graphical-mapping-tool-xi-30-sp13

Thanks

Amit

Shabarish_Nair
Active Contributor
0 Kudos

http://wiki.sdn.sap.com/wiki/display/XI/CountofRecords-%27Countontheeasiestway+through%27

this wiki should show u some solutions

stefan_grube
Active Contributor
0 Kudos

use index function