Manage Learn to apply best practices and optimize your operations.

Customizing 'No Documents Found' message without JavaScript

This tip shows you how to use a WebQueryOpen agent to see how many documents there are in a view and then pass that value back to the $$ViewTemplateDefault form.

You can use a WebQueryOpen agent to see how many documents there are in a view and then pass that value back to the $$ViewTemplateDefault form. Here is how:

  1. Create your $$ViewTemplateDefault form and add a hidden text field called "DocCount."

  2. Add the $ViewBody or embedded view and hide it if DocCount="0"; below that add your custom message. Select that text (computed text or computed for display field) and hide it when DocCount!="0".

  3. In the WebQueryOpen event of this form add the following:
    @Command([ToolsRunMacro]; 
    "(GetEntries)").
    
  4. Save the form and create the GetEntries agent.

    GetEntries agent properties:
    Trigger = On Event
    Runtime = Agent List Selection
    Target = None

Code:

Sub Initialize
 On Error Goto err_trap
 Dim s As New NotesSession
 Dim context As NotesDocument
 Set context = s.DocumentContext
 Dim db As NotesDatabase
 Set db = context.ParentDatabase
 vnm$ = context.ViewAlias(0)
 Dim view As NotesView
 Set view = db.GetView(vnm$)
 Dim vec As NotesViewEntryCollection
 Set vec = view.AllEntries
 context.DocCount = Cstr(vec.Count)
 
err_trap:
 If Not (Err = 0) Then
  Print "Error " & Cstr(Err) & " at line " 
& Cstr(Erl) & ": " & Error$
  Exit Sub
 End If
End Sub

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Jennifer Armentrout. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

This was last published in November 2004

Dig Deeper on Lotus Notes Domino Agents

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchExchange

SearchContentManagement

Close