OpenNTF.org - grab category docs from a data
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
Edit Document Code By Date > Code Document
About This Code
Brief Description:
grab category docs from a database ( shorten your code ) 
Rating:
Not Rated Yet 
Contributor:
Mike Mortin 
Category:
Lotusscript 
Type:
Miscellaneous 
Notes Version:
R6.x, R8.x, R7.x 
Last Modified:
03 Nov 2008 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
Function GetCategoryDocsFromDb( db As NotesDatabase, viewName As String, category As String ) As NotesViewNavigator

' returns all docs from a given category
' posted to http://www.openntf.org/projects/codebin/codebin.nsf/CodeBySubCategory/16B4DEA132579F6D862574EF00630D42
' written by Mike Mortin

Dim view As NotesView

' get the view
Set view = db.GetView(viewName)

' get the docs from the cateogry
Set GetCategoryDocsFromDb = view.CreateViewNavFromCategory( category )
End Function

Usage / Example
Use this to shorten your code if you don't need to declare the variables other than for the lookup
It works well in a common script library
All you have to do is define each key per column you want to return on. Here, assume the 3 columns in the PeopleByLocationview are Country, Province, and City. This would return all people who are in this location:

...
key(0) = "Canada"
key(1) = "Saskatchewan"
key(1) = "Regina"
set navdocs = GetCategoryDocsFromDb(nabDb, "PeopleByLocation", key, true)
...
 Comments

No documents found

 Add your comment!