We have requirement where we want to set counter value based on the input record:
 for e.g.
    record 1 ->    {subtradeid:100,amount:1000}
    record 2 ->    {subtradeid:100,amount:8000}
    record 3 ->    {subtradeid:200,amount:3000}
    record 4 ->    {subtradeid:300,amount:2000}
    record 5 ->    {subtradeid:300,amount:2000}
    record 6 ->    {subtradeid:500,amount:8000}
    record 7 ->    {subtradeid:500,amount:8000}
    record 8 ->    {subtradeid:500,amount:8000}
So Whenever executor processes these records, it should create counter field for each of these records which should be unique for each subtradeid.
So for all records which have subtradeid=500, it should set new field (for e.g portfolioid) which is contiguous and it should not be duplicated irrespective of executor processing that record. So if executor1 processes the record with subtradeid=500, set the portfolioid=1 and if executor2 processes the next record with subtradeid=500, then it should set the portfolioid=2 (i.e. the next counter value).
 
    