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:
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
- Create your $$ViewTemplateDefault form and add a hidden text field called "DocCount."
- 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".
- In the WebQueryOpen event of this form add the following:
- Save the form and create the GetEntries agent.
GetEntries agent properties:
Trigger = On Event
Runtime = Agent List Selection
Target = None
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.