I know the following works in a list view or table view layout and I think it also will work in your portal but you'll have to try it out and see:
Define cBal as Expense - Credits.
Define sBalance as a Total of cBal and specify that it be a running balance.
cBal need not be visible on any layout, you can just add the Expense, Credit and sBalance fields to your portal.
That worked, thank you!
I did however have to define cBal as credits - expenses b/c expenses - credits gives me a negative number.
It's working well, however i noticed that when i'm in the portal, the balance field goes blank when i assign a category to the credit/expense and then when i click out of the category, it shows the balance. Is there any way to avoid that? Should i be putting in the credit / expense figure prior to entering a category?
Thanks for catching and correcting my mistake in cBal.
The screen will go blank when you open a record for editing and then recalculate when you commit the record. That's not an issue you can get around with this approach.
GetNthRecord is another function you can use to access the value of the previous field, but it sets up a recursion limit that may cause problems if you have a large number of records in your portal and I think you'll see it go blank also, but you can give it a try.
You might have to set up a script to do the running total instead of a summary field in order to keep it from temporarily blanking out like this.
Ok. How should that script be worded?
You can use a number field in place of the summary field.
Then Go to Portal Row [Next] can access the previous row.
If ( Get (RecordNumber ) ; GetNthRecord ( Balance ; Get ( RecordNumber ) - 1 ) ; 0 )
Might also work here to access the total from the previous record.(I know it does in list and table views, test to see if it works in a portal).
Look before you leap here. While this can eliminate the field going blank, you now have to be very vigilant with your interface design, scripting an update for any user action that might need to recalculate your running total.
Imagine the looping script you'd need to use if you deleted a portal record in the middle...
Ha, interesting. Ok. Yes, overall i want to keep this as simple as possible for the user so i may consider keeping it as is, as it is doing what i need to to do. I'm simply nit picking here...