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☆t=";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

Dig deeper on Domino Resources - Part 7

0 comments

Oldest 

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:

-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 ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close