Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8347863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:30:22+00:00 2026-06-09T07:30:22+00:00

I have 6 agent, 1 form(Agent Status), 1 view(Agent Status List), & 1 script

  • 0

I have 6 agent, 1 form(“Agent Status”), 1 view(“Agent Status List”), & 1 script library(“Process Agent”).

Form fields: AgentName(stores the name of an agent), LastDate(last run date & time of agent)

View: Based on the form. AgentName is 1st column.

Each agent is named as follows(with parentheses): (Agent01), (Agent02), (Agent03), (Agent04), (Agent05), & (Agent06)

script libary code

Option Public
Option Declare

Dim vw As NotesView, doc As NotesDocument

Sub Initialize
End Sub

Sub setLastRun(db As NotesDatabase, a As NotesAgent, dte)   
    Set vw=db.Getview("Agent Status List")
    Set doc=vw.Getdocumentbykey(a.Name, True)
    If doc Is Nothing Then
        Set doc=New NotesDocument(db)
        doc.form="Agent Status"
        doc.AgentName=a.Name
        doc.LastDate=CDat(dte)
        Call doc.save(True, True)
        Call vw.Refresh()
    Else
        Call doc.Replaceitemvalue("LastDate", CDat(dte))
        Call doc.Save(True, True)
        Call vw.Refresh()
    End If  
End Sub

Function getLastRun(db As NotesDatabase, a As NotesAgent)
    Set vw=db.Getview("Agent Status List")
    Set doc=vw.Getdocumentbykey(a.Name, True)
    If Not doc Is Nothing Then
        getLastRun=doc.LastDate(0)
    Else
        Call setLastRun(db, a, Now)
        getLastRun=CDat(Now)
    End If
End Function

In each of the agent’s code, I include the following:

At the top: Use "Process Agent"

At the beginning of the code(get the last run date of this agent from the “Agent Status List” view):

Dim s As New NotesSession, db As NotesDatabase
Dim a As NotesAgent, lastdate
Set db=s.Currentdatabase
Set a=s.Currentagent
lastdate=getLastRun(db, a)

At the end of the code(set a new last run date for this agent): Call setLastRun(db, a, now)

The problem now is it can’t seem to lookup for the agent name in the “Agent Status List” view.

The description for agent name lotus help file is:
Read-only. The name of an agent. Within a database, the name of an agent may not be unique.

When I look at the view, it always create a new document each time instead of referring and updating the existing one. The name in the view appear as “Agent01” only without the parentheses. Is that the cause? Or because of the description that the name is not unique therefore can’t be lookup-ed. I don’t understand this. If everything is ok, there should be only 6 documents in the view.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:30:23+00:00Added an answer on June 9, 2026 at 7:30 am

    GetDocumentByKey is returning Nothing. The most likely cause is that you have forgotten to set the sort property on the first column of your “Agent Status List”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple feedback form PHP script that I would like to enhance
I have a feedback form which will take a couple of user inputted fields
Basically, I have a server application and associated agent process for communicating heart-beat data
I have a problem with a script timing out while fetching data form a
I have a file called: refdes2.php <script> function go(){ window.frames[0].document.body.innerHTML='<form target=_parent action=http://www.site.com/refdes3.php></form>'; window.frames[0].document.forms[0].submit() }
I have created a form to email that uses this script: <?php foreach ($_POST
I have a Build Agent that was only dealing in .Net 4.0 RC stuff,
Basically I am attempting to have an AI agent navigate a world based on
We have a team that built an agent in Mono using MonoDevelop on Mac
I have Test controller and Test agent installed on a virtual machine VM1. Test

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.