Use a button to create new records in your portal row.
Have the script do these steps.
Go to Related Records
Go to last record
Set variable[$lastYear ; "last year end stock"]
make new record
set field ["new year starting value"; $lastYear]
set variable[$portalRow ; get(recordnumber)]
go to original layout
go to portal row [$portalRow]
I'm not clear about your requirement. Presumably the "new year starting value" is a field (a calc?) in the "year" record, so can you not just display that on the relevant portal row?
EDIT - just saw Malcom's post, now I understand, i.e. that you're adding a record via the portal.
I am trying to calculate book stock in our warehouse, like this
beginningStock print damage endstock sold
2010 100 100 1 50 100+100-1-50=149
2011 50 100 0 30 50+100-0-30=120
so every year for every book, I have to take the stock volume from last year end to next year beginnig, and start another year of calculation, but I can not figure out hot to get previous protal row fileld value.
Thanks for your answer, by the way if I use a button to create new records, portal has the function to let user create portal row already, can I close that function? let user have to press the button to create new recrod?
if I use a button to create new records, portal has the function to let user create portal row already, can I close that function? let user have to press the button to create new record?
Yes. That's best.
Hi Tunghua - yes, I see. Malcolm's suggestion will do the trick, and yes, if you're providing a nice button for the user I would remove the option to create record directly in the portal - just remove "Field entry" in Browse mode.