verifying if the records are same and incrementing the count

Certified Associate Developer

hi, 

I have a record list with values 

{name:"Test1",id:1},{name:"Test1",id:2},{name:"Test2",id:3},{name:"Test1",id:4}

my output should show - pid should be concat of the name and the sequence based on count

1. id:1,pid:"Test1001"

2. id:2,pid:"Test1002"

3.id:3,pid:"Test2001"

4.id:4,pid:"Test1003"

any code suggestion will help 

  Discussion posts and replies are publicly visible