Append Value to Notes Date/Time Field

I have searched this forum and have tried numerous options given for this, all with no luck. I’m sure I’m just missing something …

I have a script that assigns a request to an individual based on specific parameters. At the time of assignment, there is a Reassignment History field that is populated with the person it was assigned to and the date/time it was assigned. Originally, this datestamp was a text field so I was using the AppendItemToText method to document in script. However, because of time zone issues, the field now needs to be converted into a date/time field. I cannot for the life of me figure out how to document the date/time the script assigns the ticket now that it’s not a text field.

The reassignment date field may be blank when the script runs, or it may have one or more values already.

Can someone help with everything I need (including DIM and REDIM statements, if necessary)??

Thanks!

Subject: Append Value to Notes Date/Time Field

Here is how I do it…

( This is a part of a subroutine where I pass the document and the date (variable dt) You could just create dt by doing Set dt = New NotesDocument( now() ) )

Dim AssignDT() As Variant

s = Ubound(doc.AssignedDate)

Redim AssignDT(s+1)

For c=0 To s

	AssignDT(c)	= doc.AssignedDate(c)

Next

AssignDT(s+1)		= dt.LSLocalTime

doc.AssignedDate	= AssignDT

If you have a problem, or working with a UIDocument let me know as I can post more code if needed.

Altenatively when I was first working with such a problem, what I did was store the values CSV and regenerated the date. So instead of storing the date in any format (that depends upon the users regional settings) I stored it as a multivalue:

yyyy,mm,dd,hh,mm,ss,tz

yyyy,mm,dd,hh,mm,ss,tz

yyyy,mm,dd,hh,mm,ss,tz

Then when you want to display the information you parse the strings, create the dates with the values. This useful, if you have to datascrub existing data.

If the company has a corporate standard on the date, then you could also be in luck knowing what format the date will always be in.

Subject: Append Value to Notes Date/Time Field

Could you simply include the time zone with the username/dattimestamp text and continue using a text list field?

Subject: RE: Append Value to Notes Date/Time Field

Unfortunately not - the users don’t want to have to “do the math” … they have an edit history field, and want to be able to see at a quick glance if a ticket was opened at 11:00AM, when it was assigned out. Tickets are opened in all time zones - the assignment can happen either manually (usually in Houston - CST) or via this script (which runs on the server and will server timestamp).

We really need something that will show what happened in the time zone you are sitting in, regardless of what time zone it happened in.

Subject: RE: Append Value to Notes Date/Time Field

You might still get this to work. Save the history field as hidden and use another display history field that converts all the times to the local time zone for the current user. You just have to be able to parse out the time setting from the history field. This way, no matter what the time zone was when it was saved in the history field, it will always display correctly for the current users time zone.

Would that work?

Subject: RE: Append Value to Notes Date/Time Field

Sounds like it will work - but I’m not exactly sure how to go about doing all that …

Subject: Use @Zone and @Adjust

@Zone will tell you what time zone the timedate value was stored in, and then based on that, you can use @Adjust to get to the local time zone value.

hth

Subject: Append Value to Notes Date/Time Field - Got it to Work!

Okay … this might be a bit convoluted, but it works, so I figured I’d share …

Dim newassigndate(0) As Variant

Dim assigndtitem As NotesItem

newassigndate(0) = Now

array1 = addoc.GetItemValue (“PastTimes_1”)

array2 = newassigndate

array3 = Arrayappend (array1, array2)

finalarray = Fulltrim (array3)

Set assigndtitem = addoc.ReplaceItemValue (“PastTimes_1”, finalarray)

Subject: Thanks for posting your solution.

OK, Wierd. Don’t understand. But, I’m going to have to give that a try.

Thanks for posting it, completely different way of trying it. I didn’t know there was AppendArray.