Which type is the field? (lotusscript)

I want to discover (for each field in a form) if the field is TEXT, NUMBER or DATE.

I tried this code:

Set db = ss.CurrentDatabase

Set fm = db.getform(formName)

Set doc = db.CreateDocument()

Call doc.ReplaceItemValue("Form", formName)



Forall field In fm.Fields

	Call doc.ReplaceItemValue(field, "")

	Set ni = doc.GetFirstItem(field)

	Print field & ": " & Cstr(ni.Type) & "<br>"

End Forall

The problem is: The propertie .TYPE returns the type of the VALUE of the field. In other words, if the field is empty, the return will always be “1280”.

How can i discover the type of the fields using lotusscript? (Are so many forms and fields that it is impossible to discover this manually using designer!)

Thanks everyone!!

Subject: Which type is the field? (lotusscript)

Well make up your mind whether you are trying to read fields from a FORM or a DOCUMENT. That will make a big difference in the results.

p.s. The properties of a field which has no value on a DOCUMENT will appear to be textual even if the field on the FORM was date or number.

Subject: Which type is the field? (lotusscript)

Can’t see what purpose doc has in your code.

Try this for a sample:

Sub Click(Source As Button)

Dim ss As New NotesSession

Dim db As NotesDatabase

Dim fm As NotesForm



Set db = ss.CurrentDatabase

Set fm = db.getform("AName")



Forall field In fm.Fields

	fieldtype% = fm.GetFieldType(field)

	Print "Field " & field & " has type " & fieldtype%

End Forall

End Sub

Tom McCann

www.mis-consulting.co.uk