Link to home
Start Free TrialLog in
Avatar of BroadAustralia
BroadAustraliaFlag for Australia

asked on

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

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)
            doc.save True, True
            Set doc = dc.GetNextDocument(doc)    
      Wend
      ws.ViewRefresh
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,

Broad

SOLUTION
Avatar of marilyng
marilyng

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of marilyng
marilyng

marilyng,
> ndf
ndt << oops, typo.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of BroadAustralia

ASKER

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?

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