TLCC Home
Try a free course
Satisfaction guaranteed!
Learn more about TLCC's training

Click here to get live help!

TLCC's July Tip of the Month

Hide details for 2.  Developer Tip - Change that "Document Not Found" message!2. Developer Tip - Change that "Document Not Found" message!

Web browser clients are often directed to a view that may not contain any documents. This might be because no documents meet the selection criteria or the database uses reader names fields to control which documents the user can see. When using the web browser client to open a Domino view which has no documents the following message is displayed:

This message can be confusing to the user. To reduce confusion, replace the default "No documents found" message with a custom message like the following:

Follow these step to replace the "No documents found" message with a custom message:

  1. Create a view template form to act as a container and provide formatting for the view. In this example the view name is "North" so the name of the view template form must be "$$ViewTemplate for North".
  2. Add these fields to the view template form (put the ViewName and Count field at the top of the form and hide them at all times):

    Field name

    Type

    Formula

    ViewName

    Text. Computed for display

    @Subset(@ViewName;-1)

    Count

    Text. Computed for display

    @Elements(@DbColumn("Notes":"NoCache";@DbName;ViewName;1))

    $$ViewBody

    Editable

    None

    NoDocsMessage

    Text. Computed for display

    @If(Count = 0; "No customers are located in the North region."; "")



  3. In the ViewName field formula, @ViewName returns the list of view names and view alias names. The @Subset function is used to return the last name or alias in the list.
  4. In the Count field formula, @DbColumn returns the list of values from the first column in the view. The @Elements function operates on this list to return the number of documents in the view to the Count field. So, if a view has no documents to display, the Count field will contain 0 (zero).
  5. The $$ViewBody field is used to position the view for display in the view template form.
  6. The @If formula in the NoDocsMessage field tests the Count field and displays the custom message when there are no documents to display.
  7. Hide the $$ViewBody field when Count field is equal to zero using the hide paragraph formula shown in this image:

    4. When you use a view template Domino does not provide the standard set of navigation links to page forward or backward, expand or collapse the view, or search the view. At a minimum, add view navigation links to page forward and backward using @DbCommand("Domino";"ViewNextPage") and @DbCommand("Domino";"ViewPreviousPage") commands.

    This techique has one limitation. @DbColumn will return an error when it returns more than about 55KB of information. Try to make the column number you specify be a column in the view that has minimal information (preferably a text constant like "a".) Otherwise, the form will return an error when your user opens a really big view. One addition that could be done is to use @IsError to trap for errors if the @DbColumn returned one because the view was too big. If there was an error, then just set the Count field equal to a number greater than zero so the view contents will display.



    Click here to try a free demonstration course.
    Click here to see more information about the R5 Beginner LousScript course.





    Copyright - The Learning Continuum Company, Ltd.