Need to get computed field populated via picklist back into date/time format??

Posted on 2006-05-04
Last Modified: 2013-12-18
Hello EE,

I am having some problems using @(Month) on a field as it is in text mode...

The field in question LeOOODate is populated via the following script, into a computed field...  ( default value LeOOODate )

Sub Click(Source As Button)
      Dim ws As New NotesUIWorkSpace
      Dim ses As New NotesSession
      Dim db As NotesDatabase
      Dim dc As NotesdocumentCollection
      Dim doc As NotesDocument
      Dim retVal As Variant
      Dim fieldVal As Variant
      Set db = ses.CurrentDatabase
      Set dc = db.UnprocessedDocuments
      retVal = ws.Pickliststrings(PICKLIST_CUSTOM, False, db.server, db.filepath, _
      "(LUOOOTrips)" , "Trips" , "Select the Direct Inhome Trip", 5)
      fieldVal = Evaluate({@Explode("} & retVal(0) & {";"###")})
      Set doc = dc.GetFirstDocument
      While Not doc Is Nothing
            doc.LeOOODate = fieldVal(0)
            doc.LeOOOID = fieldVal(1)
            doc.LeOOOLoc = fieldVal(2)
            doc.LeOOOState = fieldVal(3)
            doc.LeInhome = fieldVal(4)
   True, True
            Set doc = dc.GetNextDocument(doc)    
End Sub

The data comes into my field LeOOODate OK - but in text format (  as using @Month display Incorrect Data message... )
How do I make it come straight into the field as a date/time..?  I have stipulated on the destination form that the field is a Date/Time field ( computed )  but I think I may need to do this in the LS.

If I change the field type to Editable and open edit save doc it works fine but I don't want this field able to be modified...

I have seriously done my head in with this!! Please help me --  how I can get this data inserted as date??

Just incase I am going completely the wrong way about this I am trying to utilise @Month & @Year to extract the date data, display it in a column along with other fields...
eg...   SalesTrip + SalesLocation + TripMonth + TripYear

I hope this makes sense!!!
Much appreciated,


Question by:BroadAustralia
    LVL 18

    Assisted Solution

    Hi BroadAustralia,
    So, if I understand, you've concatenated several values into a column and are retrieving them to put into a field.


    Dim ndt as New NotesDatetime(format(fieldVal(0),"mm/dd/yyyy") + " 12:00:00 AM")

    dim ndf as NotesDateTime("")
    set ndt = new NotesDatetime(format(fieldVal(0),"mm/dd/yyyy"))

    If fieldVal(0) is a date only, then you can set the time with a string, or use the settime command to set it to midnight.

    When assigning to a field, you use the lslocaltime else you will get an error.

    doc.leOOODate = ntd.lsLocalTime

    Check the NotesDateTime Class for all the properties and methods.
    Then you can use the  year(ntd), month, day, etc.

    If fieldVal(0) is null, then your date is one of those 1/31/1899 dates.  So validate by checking the year value.

    LVL 18

    Expert Comment

    > ndf
    ndt << oops, typo.
    LVL 14

    Accepted Solution

    or doc.LeOOODate = cdat(fieldVal(0))
    LVL 18

    Expert Comment

    You know, I tend to always do the NotesDateTime because i want to make sure that the date is collected and manipulated in the correct time frame.  I can't really do this with cdat, although in a pinch it's a fast way to convert a date.
    LVL 1

    Author Comment

    Hi sorry for the time lapse!

    Cezar I used your solution as I was in a hurry & I didn't need to worry about time zone ( is this way you use other method Marliyn? time*zones*?  )..

    PS are the Redbooks the best reference source for checking Class properties / methods?

    LVL 18

    Expert Comment

    NO, I use the NotesdateTime because I can manipulate it better. :)   One is a LS Class,the other is a VB class.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
    I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
    This video discusses moving either the default database or any database to a new volume.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now