×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Refreshing Computed fields

Refreshing Computed fields

Refreshing Computed fields

(OP)
I have an application that creates documents using a lotus script agent. The script reads an input file and populates most of the fields on the form, the remaining fields on the form are computed fields based on the fields popluated by the script.

I would like to be able to reresh the document so that the computed fields get populated either at the time the form is orginally created or on some schedule later.

I have tried using the following commands in an agent.
@Command([EditSelectAll]);
@Command([ToolsRefreshSelectedDocs]);
@Command([EditDeselectAll]);SELECT @All
This works well when I run it from a view, but I get the following when I try to schedule this agent.

Started running agent 'Scheduled Refresh' on 10/15/2003 11:31:04 AM
Running on all documents in database: 1354 total
Found 1258 document(s) that match search criteria
Started running agent 'DOCREFRSH' on 10/15/2003 11:31:06 AM
Formula error: @Command and other UI functions are not allowed with this search type; please select 'Run once (@Commands may be used)'
0 document(s) were modified by formula
Done running agent 'DOCREFRSH' on 10/15/2003 11:31:06 AM
Done running agent 'Scheduled Refresh' on 10/15/2003 11:31:12 AM


Any help would be great.

Thanks

RE: Refreshing Computed fields

What's happening is somewhere in your agent you are referring to the UIdocument or some other UI interface method and agents can't use the UI functions & methods.  You'll need to find where you've referenced them in your script and figure out a way to do it to the doc rather than the uidoc.

HTH

Leslie

RE: Refreshing Computed fields

If I understand correctly, you wrote an agent with formulas that uses the open view, selects all docs and refreshes them.
Then, you just changed the execution parameters from manual to scheduled.
Unfortunately, a scheduled agent that is written with @commands MUST be set to "Run once" (as is mentioned in the error message).
Which means that your view will no longer be selected, which also means that your agent will not work. Why ? Because a scheduled agent is run by the server, and the server does not "open" views, it just accesses the collection of documents defined by the view.

What you need to do is write LScript code. Set the agent to run scheduled on all documents in the database (does not matter for LScript agents). Then use a code like this :

dim session as new notessession
dim db as notesdatabase
dim view as notesview
dim doc as notesdocument
dim olddoc as notesdocument

set db = session.currentdatabase
set view = db.getview("")'put the name of the view here
set doc = view.getfirstdocument
do while not doc is nothing
    call doc.computewithform(false,false)
    call doc.save
    set olddoc = doc
    set doc = view.getnextdocument(olddoc)
    delete olddoc
loop


That should do the trick.

Pascal.

RE: Refreshing Computed fields

(OP)
Thanks for the help.

I ended up using the computewithform in my first agent that creates the documents. So that way I only have one agent to run instead of 2.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close