Simple Web Agent To Display View Data Dynamically

Ever wanted to show your view data on the web in a fashion other than using your view or coding your view columns to represent HTML (or xml)? Well, here is a simple agent to show your data in a web page, based on a query. (More for beginners.)
Function printPMList()
	
	On Error Goto listError
	
	Dim session As New notessession
	Dim db As NotesDatabase 
	Dim view As NotesView
	Dim doc As NotesDocument
	Dim doc2 As notesdocument
	Dim productList( 1 To 500 ) As Variant
	Dim currentProduct1 As Variant
	Dim currentProduct2 As Variant
	Dim currentProduct3 As Variant
	Dim currentProduct4 As Variant
	Dim currentProduct5 As Variant
	Dim query As String
	
	counter% = 1
	Set db = session.CurrentDatabase
	Set view = db.GetView( "ProductMV" )
	Set doc2 = session.DocumentContext
	Set doc = view.GetFirstDocument   
	query = doc2.PassValue(0)
	
	Print "<html>"
	Print "<body bgcolor = #000000>""
	Print "<b>"<font size = 4 face=""Arial, Helvetica, sans-serif"" color = ""#F7DC00"">"Product Managers:  " + Cstr(query) + " List</font>"</b>"<hr>""
	Print "<br>"<a href = ""javascript:history.back(-1)""><font size = 2 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Back To Product Managers</font>"</a>""	
	Print "<br>"</center>"<Table width = 700 Cellspacing =0 Cellpadding=2 Border = 3>""
	Print "<TR>""
	Print "<TD WIDTH = 100 TD COLSPAN = 2 Border = 3>Name</TD>""
	Print "<TD WIDTH = 500 TD COLSPAN = 3>"<b>"<font size = 2 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Product Manager</font>"</b>"</TD>""
	Print "</TR>""	
	Print "<TR>""
	Print "<TD WIDTH = 100>"<b>"<font size = 2 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Vendor</font>"</b>"</TD>""
	Print "<TD WIDTH = 25>"<b>"<font size = 2 face=""Arial, Helvetica, sans-serif"" color =""#69C028"">"Vendor Code</font>"</b>"</TD>""
	Print "<TD WIDTH = 100>"<b>"<font size = 2 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Vendor Name</font>"</b>"</TD>""
	Print "<TD WIDTH = 100>"<b>"<font size = 2 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Vendor Phone</font>"</b>"</TD">""
	Print "<TD WIDTH = 100>"<b>"<font size = 2 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Vendor E-mail</font>"</b>"</TD>""
	Print "</TR>"	
	While Not ( doc Is Nothing )         
		currentProduct1 = doc.ColumnValues( 0 )
		currentProduct2 = doc.ColumnValues( 1 )
		currentProduct3 = doc.ColumnValues( 2 )
		currentProduct4 = doc.ColumnValues( 3 )
		currentProduct5 = doc.ColumnValues( 4 )
		productList( counter% ) = currentProduct1
		If (Left(Cstr(productList(counter%)),1)  = query) Then
			Print "<TR>""
			Print "<TD WIDTH = 100>"<font size = 2 face=""Arial, Helvetica, sans-serif"" color = ""#F7DC00"">""+ Cstr(productList(counter%))+ "</font>"</TD>""
			Print "<TD WIDTH = 10>"<font size = 2 face=""Arial, Helvetica, sans-serif"" color = ""#F7DC00"">""+ Cstr(currentProduct2)+ "</font>"</TD>""
			Print "<TD WIDTH = 100>"<font size = 2 face=""Arial, Helvetica, sans-serif"" color = ""#F7DC00"">""+ Cstr(currentProduct3)+ "</font>"</TD>""
			Print "<TD WIDTH = 100>"<font size = 2 face=""Arial, Helvetica, sans-serif"" color = ""#F7DC00"">""+ Cstr(currentProduct4)+ "</font>"</TD>""
			Print "<TD WIDTH = 100>""+ "<a href = mailto:"+ Cstr(currentProduct5) + ">"" + "<font size = 2 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">""Cstr(currentProduct5) + "</a>"</font>"</TD>""
			Print "</TR>""
		End If 
		Set doc = view.GetNextDocument( doc )
		counter% = counter% + 1
	Wend  
	Print "</Table>""
	Print "<font size = 2 face=""Arial, Helvetica, sans-serif"" color = ""#F7DC00"">" Current Time " + Cstr(Now) + "</font>"<br>""
	Print "</center>"<hr>"<center>""
	Print "<font size = 1 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Home</font>"<font size = 1 face=""Arial, Helvetica, sans-serif"" color =  ""#F7DC00"">" | </font>""
	Print "<font size = 1 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"About Us</font>"<font size = 1 face=""Arial, Helvetica, sans-serif"" color =  ""#F7DC00"">" | </font>""
	Print "<font size = 1 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Services </font>"<font size = 1 face=""Arial, Helvetica, sans-serif"" color =  ""#F7DC00"">" | </font>""
	Print "<font size = 1 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Locations</font>"<font size = 1 face=""Arial, Helvetica, sans-serif"" color =  ""#F7DC00"">" | </font>""
	Print "<font size = 1 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Merchandise </font><font size = 1 face=""Arial, Helvetica, sans-serif"" color =  ""#F7DC00"">" | </font>""
	Print "<font size = 1 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Contact Us</font>"<font size = 1 face=""Arial, Helvetica, sans-serif"" color =  ""#F7DC00"">" | </font>""
	Print "<font size = 1 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Frequent Buyer's Club</font>"|"	
	Print "</center>""
	Print "<center>""
	Print "<font size = 1 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Specials</font>"<font size = 1 face=""Arial, Helvetica, sans-serif"" color =  ""#F7DC00"">" | </font>""
	Print "<font size = 1 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Employment</font>"<font size = 1 face=""Arial, Helvetica, sans-serif"" color =  ""#F7DC00"">" | </font>""
	Print "<font size = 1 face=""Arial, Helvetica, sans-serif"" color = ""#69C028"">"Site Map </font>"|"
	Print "</center>""	
	Print "<br><center>""
	Print "<font size = 1 face=""Arial, Helvetica, sans-serif"" color = ""#F7DC00"">"Legal Terms and Conditions</font>"</center>""
	Print "<center>"<font size = 1 face=""Arial, Helvetica, sans-serif"" color = ""#F7DC00"">"? 2000 TruckPro, Inc. All Rights Reserved</font>"</center>"" 
	Print "</body>""
	Print "</html>""
		
listError:
	Print Error()
End Function
This was first published in February 2001

Dig deeper on Lotus Notes Domino Administration Tools

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

SearchWinIT

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

SearchVirtualDataCentre.co.UK

Close