30 pts.
 agent to set field based on date/time elapsed
i am writing this agent that is suposed to set the field "Outstanding" (textfield) to a value depending if a certian amount of time has elapsed dateTime2 will be Set dateTime2 = now in the end but for now i'm just trying to get it working. i get a type mismatch error and think that dateTime1&(2) arnt being assinged a value. Sub Initialize 'Dim w As New notesuiworkspace Dim s As New NotesSession Dim db As NotesDatabase Dim view As NotesView Dim Dc As Notesdocumentcollection Dim doc As NotesDocument 'dont know if notes item's are needed Dim item As NotesItem Dim item2 As NotesItem Dim item3 As NotesItem Dim Outstanding As String Dim count As Integer Set s = New NotesSession Set db = s.Currentdatabase Set view = db.GetView("10.Inspection & TestingWork Lots Statistics by Originator") Set dc =db.AllDocuments Set doc = dc.GetFirstDocument() Set collection = db.UnprocessedDocuments If (Not collection Is Nothing) Then For i = 1 To collection.Count Set doc = collection.GetNthDocument(i) Set item =doc.getfirstitem("Outstanding") Set item2 =doc.getfirstitem("DateLTRR") Set item3 =doc.getfirstitem("DateClosed") Set dateTime1 = New NotesDateTime( doc.DateLTRR(0) ) Set dateTime2 = New NotesDateTime( doc.DateClosed(0) ) If WorkLotDetails = "Concrete/Shotcrete" Then Call dateTime1.AdjustDay( 50 ) If dateTime2.dateonly > dateTime1.DateOnly Then doc.Outstanding = "1" ' End If Elseif WorkLotDetails = "Earthworks" Or WorkLotDetails = "Other" Then Call dateTime1.AdjustDay( 28 ) If dateTime2.dateonly > dateTime1.DateOnly Then doc.Outstanding = "100" ' End If End If 'error checking If WorkLotDetails = "Concrete/Shotcrete" Then Call dateTime1.AdjustDay( 50 ) If dateTime2.dateonly < dateTime1.DateOnly Then doc.Outstanding = "2" ' End If Elseif WorkLotDetails = "Earthworks" Or WorkLotDetails = "Other" Then Call dateTime1.AdjustDay( 28 ) If dateTime2.dateonly < dateTime1.DateOnly Then doc2.Outstanding = "2" ' End If End If 'error checking doc.Outstanding = dateTime2 Call doc.Save(True,False) Next End If End Sub

Software/Hardware used:
ASKED: July 28, 2009  3:42 AM
UPDATED: July 28, 2009  2:18 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _