Hi - No it should work.
Did you check the screenshot which i provided? is that not what you are expecting.
steps :
Map the UDF provided by Sreeni to your sequence number field
map my udf from source detail - target detail (only first detail segment)
for the other 4 duplicated details map directly. don't use UDF
don't change anything in the UDF. especially the name "counter" should be same in both the UDF's