40 pts.
 Updating Field Default Values With An Agent v7.5
I have a form with total fields that derive their value from a @Sum(DBLookup) default value formula.   The totals update whenever the form is opened.  However, I want to update the totals WITHOUT opening the form.  I tried the following code in an agent with no success.  Can this be done?

Set viewC = db.GetView"(StudentProfs)")         

 Set docC = viewC.GetFirstDocument

Do While Not docC Is Nothing

    Call docC.ComputeWithForm(True, False)

    Call docC.Save(True, False)



    Set docC = viewC.GetNextDocument(docC)

Loop  

 

Thanks!!!!!



Software/Hardware used:
Domino Development v7.5
ASKED: October 6, 2011  7:43 PM
UPDATED: March 31, 2012  12:30 AM

Answer Wiki:
Something's not right here. Default values should only be calculated when the doc is first created. If your values update every time the doc is opened, then then it's more likely that they are calculated fields, or calculated for display, or there's code somewhere else (like a postopen event) that's doing the updating. OTOH, if the code really is only in the default value, then that would explain why the ComputeWithForm isn't working. I think you'll need to clarify the situation before you can solve your problem.
Last Wiki Answer Submitted:  October 7, 2011  1:12 pm  by  Stiletto   2,725 pts.
All Answer Wiki Contributors:  Stiletto   2,725 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Yes, the fields are computed and show the total derived from the @sum DBLookup formula. Sorry for the misunderstanding.

 40 pts.

 

In that case, I think you’ll have to make your agent do the dblookup and replace the field value. The down side, of course, is that if the formula changes, you’ll need to remember to change the calculation in both the field and the agent. Sorry.

 2,725 pts.

 

All calculation should be generally done on computed or computed for display fields. it is neat and quick

 1,075 pts.