Is this the result that you want?
tot = 5
If that's what you want, it would be simpler to make tot the initial Length value in the first record of the portal. Then Total becomes a summary field that computes a running total of Length.
If that's not possible, then you need a more complex calculation field for Total:
Let ( R = Get ( RecordNumber ) ;
If ( R = 1 ; ParentTO::tot + Length ; GetNthRecord ( Total ; R - 1 ) + Length )
) // Let
Thanks again Phil, I'm learning a lot from you. Thanks again!