Use script triggers to do a Refresh window. You can use OnObjectSave or OnObjectExit triggers to do this. You do get a bit of "window flash"--at least on windows systems when you do this.
Replace the summary field with a calculation field in your layout's table that uses Sum (portalTable::hoursField) to compute the total. It will update smoothly without any need for scripting a window refresh.
I had previously tried the refresh window script trigger on object exit and it didn't work.
I will try to use a sum instead... but I don't understand how I make the sum field calculate the total hours of the employee for that week.
For example on form view I have
Employee Name: John Smith
Date: May 6, 2011
THen in a portal from related fields I have:
Cost Code Hours
And I want the sum to show: 36 but all of the codes are created as new records in another field. I only want the sum for the selected date... can I still make a calculation for the sum instead of using the summary field? I would much prefer that but I can't figure out how to set it up!
Oops I was a little quick on the trigger on the last post.
You're right I just used the sum of the portal hour field and its keeping it up to date!
Thanks for your help!
Refresh window should work. You may need to include a commit record step or use it in place of refresh window.
Are you using the date in a portal filter expression?
If so, then sum won't return the correct total as aggregate functions ignore any portal filter expressions.
There are, however, ways to structure the relationship to include a global date field that "filters" the records shown at the relationship level and then Sum and other such functions can compute values consistant with the records displayed in the portal.
Say you have this relationship:
Employees::EmpID = TimeWorked::EmpID
Change it to:
Employees::EmpID = TimeWorked::EmpID AND
Employees::gSelectedDate = TimeWorked::DateWorked
and you can enter/select a date in gSelectedDate to see the work done on that date and your sum function will compute the total time correctly.