NotesItem returning incorrect Type

Hi There,

I have the below code, which is part of a greater routine. The code gathers a list of fields and get’s their names and data types.

My problem is that some of the date fields are being returned as text fields… I’ve watched it in debugger and the dates are being reported as 1280 - text. Any reasonable explainations would be welcomed. Thanks.

'Compute the temp doc so we can get handles on the fields

Call docTemp.ComputeWithForm(False, False)

varFields = docTemp.Items

'Prime counter

i = 0

Forall item In varFields

Redim Preserve varFieldTypes(i),varFieldNames(i)

Select Case item.Type

Case 1024

varFieldTypes(i) = “Date/Time”

Case 1280

varFieldTypes(i) = “Text”

Case Else

varFieldTypes(i) = “Unknown”

End Select

varFieldNames(i) = item.Name

'Increment counter

i = i + 1

End Forall

Subject: NotesItem returning incorrect Type

Unfortunately the Type reports the type of the value stored in that item not the type of field in the underlying form.

For example if the default value of a date field is “” then after a computewithform the type will be 1280 as the contents are text!

HTH - Rufus.

Subject: RE: NotesItem returning incorrect Type

Oh, bugger. How inconvenient for me!

Subject: RE: NotesItem returning incorrect Type

And how convienient for you that there’s a new feature in ND6+ that allows you to get a field on a form and query its design type:

NotesForm.GetFieldType(“FieldName”)

The type returns are the same as for NotesItem.Type.

Subject: RE: NotesItem returning incorrect Type

Ripper! That is convenient, thanks Stan, I’ll take a good look at that. Cheers.

Subject: RE: NotesItem returning incorrect Type

Okay that worked great, but why are some fields which are author, dates, numbers, etc being detected as unknown (0 - zero)…

Subject: RE: NotesItem returning incorrect Type

response.Type is also 0. Sorry, I just use the stuff, I don’t write it.