TechTip: Working with Lotus Domino WebQuery Events

Collaboration & Messaging
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

WebQueryOpen Event

To generate a unique number within a document and save this computed value, use a Lotus Domino agent that is called by the WebQueryOpen event. The following excerpt from Lotus Domino Designer help text explains how the WebQueryOpen event works:

WebQueryOpen agents run when the user opens a form or document, but do not run when the user saves a document. This means that computed fields set by a WebQueryOpen agent are not saved when the user submits a document. To make sure computed fields are saved, you can either recalculate them in the WebQuerySave agent or set the form property "Generate HTML for all fields."

After selecting the form property "Generate HTML for all fields," the computed number is saved along with all of the other fields in the document.

WebQuerySave Event

We wanted to allow only unique city codes to be saved when creating a new unique city code from the Web.

The following excerpt from the Lotus Domino Designer help text explains how the WebQuerySave event works when checking for unique values:

Simulate CGI programs that run on user-supplied data by programming a WebQuerySave event and adding a SaveOptions field with a value of '0' to the form. When the agent runs, you can collect field values from the filled-out form without generating a new Notes document.

Having the SaveOptions set to 0 will keep the document from being saved. As soon as this value is set to 1, the document is saved. There is no need to perform an "if" check on SaveOptions in the submit button. Lotus Domino handles the saving based on the value of the SaveOptions field.

For example, here is the solution we used:

1. In the Form, create a Submit button as well as a hidden field called SaveOptions with an initial value of 0.

2. In the Submit button, code the following formula:
@Command([FileSave]);
@Command([FileCloseWindow])

3. In the WebQuerySave event, enter the formula that runs an agent.
4. In the agent, add the following code:
If (foundCityCode) Then
Print ""
Else
'// The following line will set the SaveOptions on the document as 1 which will cause
'// Notes to save the document.
Set item = doc.ReplaceItemValue("SaveOptions", 1)
End If

Dan Boyum is a Software Engineer on the Business Solution Test team located at the Rochester, Minnesota, laboratory. He has 2.5 years of experience in the software testing field. His areas of expertise include Lotus Domino and Windows servers on iSeries. Dan can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..

Marilyn Dukart is an Advisory Software Engineer on the Business Solution Test team located at the Rochester, Minnesota, laboratory. She has over 15 years of experience in the software testing field. Her areas of expertise include Lotus Domino and WebSphere. Marilyn can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..

Dan Boyum is an Advisory Software Engineer on the IBM i System Test team located at the Rochester, Minnesota, laboratory. Dan is the Technical Leader of the IBM i Post-GA Test team.  He has been in the software testing field since 2000. Dan can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it..

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: