AnsweredAssumed Answered

New Sequential Portal Record

Question asked by fmnewb on Sep 28, 2010
Latest reply on Sep 29, 2010 by LaRetta_1

Title

New Sequential Portal Record

Post

I'm trying to script a button that will add a new portal record, using another portal record's information. In this example, the portal shows each budget year:

Budget Year 1 Start & End: 2008-2009

Budget Year 2 Start & End: 2009-2010

etc.

I want it to take the latest budget year's (in the example above Budget Year 2) info and use any of its field values as defaults for the new portal record. The script I have now works but involves looping. I was wondering if there is a more efficient method?

This is essentially what I currently have

---------------------------------------------------

Set Variable [$MaxBudgetStart]; Value:Timestamp ( Date(1;1;1950); Time(0;0;0) )] //default max date

Go to Object [Object Name: "myPortal"]

Loop

Go to Portal Row [Select; Next]

If [table::budgetStartDate > $MaxBudgetStart]

//update $MaxBudgetStart

//keep track of portal row number in $LatestBudgetYearRow

End If

Exit Loop If [IsEmpty (table::budgetStartDate)]

End Loop

If [not isEmpty($LatestBudgetYearRow)]

Go to Portal Row [No dialog; $LatestBudgetYearRow]

//store field values in local variables

Go to Portal Row [Select; Last] //new portal row record

//set field values using local variables

Else

Go to Portal Row [Select; Last]

End If

--------------------------

Thanks!

Outcomes