OpenNTF.org - Document Propeties field list
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
About This Code
Brief Description:
Document Propeties field list alternative 
Rating:
Not Rated Yet 
Contributor:
A J Pope 
Category:
Lotusscript 
Type:
System info 
Notes Version:
R4.x, R5.x, R6.x 
Last Modified:
15 Jan 2003 
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
This is a piece of code I development a long time ago (v4.??) that is invaluable when developing, debugging and maintaining databases. Basically a form is used to display all document fields and their contents rather than use the document properties field list.:


<$EncryptionStatus> (40) 0
<$SignatureStatus> (41) 0
<$UpdatedBy> (39) CN=FRED BLOGGS
<auAuthors> (38) [DBADMIN];[ABC AUTHORS]
<Form> (0) fForm
<namFormAuthors> (28) [ABC AUTHORS]
<namFormReaders> (29) [ABC READERS]
<rdReaders> (37) [DBADMIN];[ABC READERS]

Where the format is:
<field name> (field number in document) field contents

There are only two design elements required a view and a form which, once created, can be copied to any database.

FORM
The form Synopsis is listed below but in summary;

Create a form with two fields: "SaveOptions" computed to "0" as you don't want to save the document using this form
"dtxtlstFields" computed for display: value: txtlstFields. Multi value, each value on a new line.

The form should not be available from the Compose Menu.
The QueryOpen code calls Sub GetFieldList which reads all the fields in the document and copied them to the field txtlstFields. There is also a sorting sub (I think came from Notes.net some time ago) which sorts the fields alphabetically.


VIEW
The view can be any view you like but must have a form formula computing to the Display Fields form name. I generally create a "All Docs" view categorised by Form and not hierarchical with a role so that it is only available to db administrators.

ISSUES
Obviously the form will only display the field in the document not any computed for display fields or not yet computed fields that may be coded in the application forms.
Rich text fields a not handled very well.
Printing from a the view is not possible since the QueryOpen needs to run.

Form Information
Name: z. Display Fields
Alias: fDisplayFields
Last Modification: 15/01/2003 10:40:50
Comment: [Not Assigned]
Type: Document
Window Title Formula: "Field List: " + Form;
Include in Compose Menu: No
Include in Query by Form: No
Default Database Form: No
Automatically Refresh Fields: No
Mail New Documents When Saving: No
Store Form In Documents: No
Inherit Default Field Values: No
Updates Become Responses: No
Retain Prior Versions As Responses: No
Activate Objects When Composing: No
Activate Objects When Editing: No
Activate Objects When Reading: No
Document Encryption Keys: [None Assigned]
Composed Documents May Be Read By: All Users
Form May Be Composed By: All Users
Subcomponents:
Field: SaveOptions
Datatype: Text
Help Description: [Not Assigned]
Field Type: Computed
Sign When Mailing/In Section: No
Encryption: Disabled
Update Requires Editor Access: No
Formula: "0"
Is Scripted: No
Field: dtxtlstFields
Datatype: Text
Input Multi-Value Separator(s): New Line
Display Multi-Value Separator: New Line
Help Description: [Not Assigned]
Field Type: Computed for display
Sign When Mailing/In Section: No
Encryption: Disabled
Update Requires Editor Access: No
Formula: txtlstFields
Is Scripted: No
JavaScript & HTML Code:
[None]
LotusScript Code:
(Form) fDisplayFields
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
GetFieldList Source
End Sub
Function SortedStringArray( array As Variant ) As Variant
' sort an Array and returns the sorted array
' This sort puts blank entires at the botton of the list.
Dim CurrentLowest As String 'Will contain the current lowest value. This is not strictly needed as the location can supply the value but it makes debugging easier
Dim CurrentLowestPos As Integer ' tracks the location of the current lowest value
Dim max As Integer
Dim i As Integer, j As Integer
max = Ubound(array)
Redim TempArray(max) As String
For i = 1 To max
CurrentLowest = ""
For j = 1 To Max
If Array(j) <> "" Then ' Ignore blank entries
If CurrentLowest > Array(j) Or CurrentLowest = "" Then
CurrentLowest = Array(j)
CurrentLowestPos = j
End If
End If
Next
TempArray(i) = CurrentLowest
array(CurrentLowestPos) = ""
Next
SortedStringArray = TempArray
End Function
Sub GetFieldList (Source As NotesUIDocument)
' This code will go through all the items on the form and display them in the txtFieldList field
Dim Doc As NotesDocument
Set Doc = Source.Document
Const CONST_ListField = "txtlstFields"
Set FieldList = New NotesItem( Doc, CONST_ListField,"" )
numfields = 0
Forall i In Doc.Items
If i.name <> CONST_ListField Then
tnewline = "<" & i.Name & "> (" & Cstr(numfields) & ")" & Chr(9) & Chr(9) & i.text
Call FieldList.AppendToTextList( tnewline)
numfields = numFields + 1
End If
End Forall
'Now Sort the Field
Redim FieldValues(numfields) As String
Dim j As Integer
j = 0
Forall ent In FieldList.Values
j = j + 1
FieldValues(j) = ent
End Forall
Redim SortedFieldValues(numfields)
Set FormListField = Doc.ReplaceItemValue( CONST_ListField, SortedStringArray(FieldValues))
End Sub
[None]

Usage / Example
 Comments

No documents found

 Add your comment!