Manage Learn to apply best practices and optimize your operations.

Show me all fields

Do you ever need a list of all the field names on a form?

Do you ever need a list of all the field names on a form? You could just print the form, but what if you have tabbed tables? Then you'd have to print the form multiples times for each row in the table. Here is a quick agent which allows you to pick the form and list all the fields on a document ready for printing. Its only requirements are the agent and one form.

Option Public
Option Declare

Sub Initialize

	Dim session As New NotesSession
	Dim db As NotesDatabase
	Set db = session.CurrentDatabase

	'make array of all forms in database
	Dim arrForms() As Variant
	Dim count As Integer
	count = -1
	Forall f In db.Forms
		count = count + 1
		Redim Preserve arrForms( count )
		arrForms( count ) = f.Name
	End Forall

	Call SortArray( arrForms )

	Dim workspace As New NotesUIWorkspace
	Dim selectedForm As Variant
	selectedForm = workspace.Prompt( PROMPT_OKCANCELLIST , "Select Form"
, "Please select a form." , arrForms(0) , arrForms )

	If selectedForm = "" Then
		Exit Sub
	End If

	'make array of all fields on selectedForm
	Dim form As NotesForm
	Set form = db.GetForm( selectedForm )

	Dim arrFields() As Variant
	count = -1

	Forall f In form.Fields
		count = count + 1
		Redim Preserve arrFields( count )
		arrFields( count ) = f
	End Forall

	Call SortArray( arrFields )

	'send field list to blank document
	Dim docDisplay As NotesDocument
	Set docDisplay = db.CreateDocument
	docDisplay.Form = "Show Me"
	docDisplay.Values = arrFields

	Call workspace.EditDocument( True, docDisplay, True )

End Sub

Sub SortArray( array )

	Dim length As Integer
	Dim i As Integer, j As Integer
	Dim temp As Variant

	length = Ubound(array)
	For i = 0 To length
		For j = i + 1 To length
			If array(i) > array(j) Then
				temp = array(j)
				array(j) = array(i)
				array(i) = temp
			End If

End Sub

Then create one form named "Show Me" with one computed field called "Values", with a value of itself. Select to show each value on a separate line.

I also put two actions on the form: Close & Print.

Dig Deeper on Domino Resources - Part 7

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials'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 ...