What is the difference between a Notes Date Time value and a Date/time value in a form?

I have create a Notes Date time value in Lotus script and stored in a new document without using a form :

Dim Dt as new NotesdateTime(Now)

Call Dt.SetNow

Set Doc=db.createDocument

Set it=New NotesItem(doc,“c_timestamp”,“”)

Set it.DateTimeValue=dt

call Doc.save(true,false)

I then wanted to show this field in a view column and … I could not ! The field is unusable in a view. Although the field is in the Document properties /2.tab clearly shown as Time/Date field with 8 bytes and I can see the values,there seems to be only one method to make the view display this field: I had to open the docs concerned in a form in edit mode, add a blank and save them … and it worked like a charm.

So my question is: What is the difference between a Date/Time value created/changed in a form and one created in LS without a form ? AND is it eventually possible to create with Lotus Script a Date/Time value that would be equal to one coming from a form and that is accepted by a view ?

Kind Regards, Joe Herrmann

Subject: Workaround solution: Field flags

I meanwhile have found out what happened and found a workaround:

The field flag “Summary” is not set in a Date/Time field that was created with Lotus Script without any form envolved. And thats why it can’t be displayed in a view.

The following code now works:

Set it=New NotesItem(NewNote,“c_published”,dt)

It.IsSummary=True 'flag needs to be set to display DT in a view

Obviously this is NOT set automatically by Lotus Notes. I consider this as a bug.

Joe Herrmann

Subject: it’s not a bug

While it may be annoying to you, Notes has always behaved this way. You may disagree with that design decision, but it’s the expected behavior. Changing it now would break a lot of applications.

Subject: Try this…

Hi Joe ! :wink:

Instead of :

Set it=New NotesItem(doc,“c_timestamp”,“”)

Set it.DateTimeValue=dt

Try :

Set it=doc.replaceItemvalue(“c_timestamp”,dt)

It might work better.

Renaud

Subject: Thx for the reply

Hi Renaud,

good to see you here. :wink:

Thanks a lot for you reply. But I already have found out what the problem is:

The summary flag in a Date/Time item is not automatically set, if one creates the doc and its items entirely within Lotus Script; without using a form (computeWithForm). But the view wants to have it for whatever reason and does not accept a D/T field without this flag set.

So one has to set it in LS with:

It.IsSummary=True

and it works.

Joe