Who is this guy?

PlanetLotus.org

Idea Jam

Flickr Photos

www.flickr.com
This is a Flickr badge showing photos in a set called BlogPics. Make your own badge here.

Blogroll

The Badges

July 16th, 2009

S&TT - Using ComputeWithForm to Refresh documents via a Scheduled Agent

This may be old hat to some of you, but it was new to me, so I'm posting it even if it's only for my benefit in some future coding endeavor.

I have some documents in a view which have a computed "days past due" field which calculates based off another computed/looked-up field and the current day's date. 

Nothing else on the document is computed or in any way complicated, so I thought I'd just see if I could find a way to re-compute the documents each day.  While doing some searching in the 6 and 7 forum, I came across this gem.

Instead of a running on a collection, I just have it run through my view and it does the job neat and tidy, and I have it scheduled just after midnight so all is good for the day when the users look at the view.

Set doc=mr_view.getFirstDocument
 
Do While Not doc Is Nothing
  Call doc.ComputeWithForm(True,False)
  Call doc.save(True,False)
  Set doc=mr_view.getNextDocument(doc)
Loop

I hadn't known you could use computewithform in this way, but it appears you can...

Gotta love 6 1/2 year old forum posts!

March 2010
Su
Mo
Tu
We
Th
Fr
Sa
1
2
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

OpenNTF.org

Latest Googles

Latest Referrers

Credit where it's due

Special thanks to Chris Miller at Connectria for providing hosting services for this site.

How many did you say?

brave souls have visited this strange place

Super Secret Web Admin Thingie ;-)