Tip

Jump to the end of a view (web agent)

When displaying a view, it is sometimes useful to have a link to its end.
There is an agent that will redirect you to the bottom of a view...
The way to use it :
<a href='/server/base.nsf/aa_eofView?openAgent&view=viewalias'$gt;Jump to end!</a>
where :
server is the name of your domino server,
base.nsf is the name of the base containing both the view and the agent, aa_eofView is the name of this agent, and viewAlias is the name of your view... PS : getParam and webSyntax are functions used to parse the query string and to format the database file path.
Option Public
Option Declare

Sub Initialize
	
	On Error Goto errorLabel
	
	Dim s As New notesSession
	
	Dim sdoc As notesDocument
	Set sdoc = s.documentContext
	
	Dim db As notesDatabase
	Set db = s.currentDatabase
	
	Dim viewName As String
	viewName = getParam ("&view=", sdoc.query_string(0))
	
	Dim view As notesView
	Set view = db.getView (viewName)
	
	If view Is Nothing Then		
		Print "Error : view not found<br>"
		Print "<a href='javascript:history.go(-1)'>back</a>"
		Exit Sub
	End If
	
	Print "[/"+webSyntax(db.filepath)+"/"+viewName+"?
openView&start=";Trim$(Str$(view.topLevelEntryCount));"]"
	
	Exit Sub
	
errorLabel:
	Print "Error : ";Error$(Err);" at line ";Erl
	Print "<a href='javascript:history.go(-1)'>back</a>"
	Resume endLabel
	
endLabel:
	
End Sub

Function getParam (keyname, query) As String
	Dim rstr As String
	Dim pos As Integer
	
	If (Left$(keyname,1)<>"&") Then
		keyname = "&"+keyname
	End If
	
	pos = Instr(Ucase(query), Ucase(keyname))
	If pos>0 Then
		rstr = Right$(query, Len(query)-pos+1-Len(keyname))		
		pos=Instr(rstr, "&")		
		If pos>0 Then
			rstr=Left(rstr,pos-1)
		End If		
		getParam = rstr
	Else
		getParam=""
	End If
	
End Function

Function webSyntax(s) As String
	Dim pos As Integer
	
	webSyntax = s
	
	pos = Instr(webSyntax,"")	
	While pos>0
		Mid$(webSyntax,pos,1)="/"		
		pos = Instr(webSyntax,"")
	Wend
	
	pos = Instr(webSyntax," ")	
	While pos>0
		Mid$(webSyntax,pos,1)="+"		
		pos = Instr(webSyntax," ")
	Wend
	
End Function

This was first published in April 2001

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
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
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.