AnsweredAssumed Answered

Access records in a portal

Question asked by SteveJames on Nov 18, 2011
Latest reply on Nov 18, 2011 by philmodjunk


Access records in a portal


I have a Case table where each case can have a set of financial Ledger records associated with it.

Each month the loans are processed and interest is calculated by applying the interest to each transaction. (That bit I can do)

I then want to go through the Ledger records collect up the individual interest, by Case, and add this total to the balance in the Case record.

I have tried using the portal option - new layout with the Portal control on it - with no success

I have tried the script below.  

Set Variable [ $TotalLedger; Value:0 ] 
Go to Layout [ “portLedger” (aflCase) ]   ' The layout holds the portal holding the ledger records filtered for the selected Case
Go to Portal Row 
[ Select; First ]      ' Start at the first record of the selection. This seems to take the pointer to the first record in the Ledger table.

     Set Variable [ $TotalLedger; Value:$TotalLedger  + aflLedger::ledNetAmount ]    ' Do the calculation to consolidate the entries
     Go to Record/Request/Page [
Next; Exit after last ] 

End Loop 

Go to Layout [ “aflCase” (aflCase) ] 
Set Field [ aflCase::casEoMBalance; $TotalLedger ]     ' Save the amount in the relevant case field

The above works in a way but it always picks the same set of Ledger records regardless of which Case has been selected.