Hi All,
I have a problem with the table alignment...
Scenario:
I have a daily scheduled agent, which will runs on all documents in a db. It sends alert reports based on some condition... Pls go thru with my code below...
==================================================
Sub Initialize
Dim ses As New Notessession,Db As Notesdatabase,View As Notesview,Doc As Notesdocument,Maildoc As Notesdocument
Dim Rtitem As notesrichtextitem,Docoll As Notesdocumentcollection,AlertDoc As NotesDocument
Dim dateTime As New NotesDateTime("")
Dim oriTime As NotesDateTime
Set Db=ses.CurrentDatabase
val1=Evaluate({@DbColumn("":"NoCache";"":"";"AlertReport1";1)})
Set View=Db.GetView("AlertReport1")
Forall srowner In val1
Set Docoll = View.GetAllDocumentsbyKey(srowner)
Set Doc = Docoll.GetFirstDocument
If Doc Is Nothing Then
Msgbox "No documents found."
Exit Sub
Else
Set AlertDoc = New NotesDocument(Db)
AlertDoc.Form = "NewAlertForm1"
Set Item1=New notesitem(AlertDoc,"TextSr","")
Set Item2=New notesitem(AlertDoc,"TextTitle","")
Set Item3=New notesitem(AlertDoc,"TextEstDt","")
Set Item4=New notesitem(AlertDoc,"TextSchReDt","")
Set Item5=New notesitem(AlertDoc,"TextSchStDt","")
Set Item6=New notesitem(AlertDoc,"TextSysStDt","")
Set Item7=New notesitem(AlertDoc,"TextUATStDt","")
Set Item8=New notesitem(AlertDoc,"TextProdTOverDt","")
Call AlertDoc.computewithform(True,False)
i%=0
While Not Doc Is Nothing
'---------------------Checking Estimation Received Date
If Doc.TextEstRecPlanDt(0) <>"" Then
Set dateTime = New NotesDateTime(Today)
Set oriTime = New NotesDateTime(Doc.TextEstRecPlanDt(0))
Call oriTime.AdjustDay(2)
If dateTime.TimeDifference(oriTime) > 0 And Doc.TextEstRecDt(0) = "" Then
Set Item1=AlertDoc.getfirstitem("TextSr")
Set Item2=AlertDoc.getfirstitem("TextTitle")
Set Item3=AlertDoc.getfirstitem("TextEstDt")
Call item1.appendtotextlist(Doc.TextSR(0))
Call item2.appendtotextlist(Doc.TextTitle(0))
Call item3.appendtotextlist(Format(Doc.TextEstRecPlanDt(0),"MMM-DD-YYYY"))
Call item1.appendtotextlist(" ")
Call item2.appendtotextlist(" ")
Call item3.appendtotextlist(" ")
Else
Call item1.appendtotextlist(Doc.TextSR(0))
Call item2.appendtotextlist(Doc.TextTitle(0))
Call item3.appendtotextlist(" - ")
Call item1.appendtotextlist(" ")
Call item2.appendtotextlist(" ")
Call item3.appendtotextlist(" ")
End If
Else
Call item1.appendtotextlist(Doc.TextSR(0))
Call item2.appendtotextlist(Doc.TextTitle(0))
Call item3.appendtotextlist(" - ")
Call item1.appendtotextlist(" ")
Call item2.appendtotextlist(" ")
Call item3.appendtotextlist(" ")
End If
'---------------------End Checking Estimation Received Date
'---------------------Checking Schedule Received Date
If Doc.TextScheRecPlanDT(0) <>"" Then
Set dateTime = New NotesDateTime(Today)
Set oriTime = New NotesDateTime(Doc.TextScheRecPlanDT(0))
Call oriTime.AdjustDay(2)
If dateTime.TimeDifference(oriTime) > 0 And Doc.TextSchRecDt(0) = "" Then
Set Item4=AlertDoc.getfirstitem("TextSchReDt")
Call item4.appendtotextlist(Format(Doc.TextScheRecPlanDT(0),"MMM-DD-YYYY"))
Call item4.appendtotextlist(" ")
Else
Call item4.appendtotextlist(" - ")
Call item4.appendtotextlist(" ")
End If
Else
Call item4.appendtotextlist(" - ")
Call item4.appendtotextlist(" ")
End If
'---------------------End Checking Schedule Received Date
'---------------------Checking Schedule Start Date
If Doc.TextSchStartPlanDt(0) <>"" Then
Set dateTime = New NotesDateTime(Today)
Set oriTime = New NotesDateTime(Doc.TextSchStartPlanDt(0))
Call oriTime.AdjustDay(2)
If dateTime.TimeDifference(oriTime) > 0 And Doc.TextSchStartActDT(0) = "" Then
Set Item5=AlertDoc.getfirstitem("TextSchStDt")
Call item5.appendtotextlist(Format(Doc.TextSchStartPlanDT(0),"MMM-DD-YYYY"))
Call item5.appendtotextlist(" ")
Else
Call item5.appendtotextlist(" - ")
Call item5.appendtotextlist(" ")
End If
Else
Call item5.appendtotextlist(" - ")
Call item5.appendtotextlist(" ")
End If
'---------------------End Checking Schedule Start Date
'---------------------Checking System Test Start Date
If Doc.TextSysStartPlanDT(0) <>"" Then
Set dateTime = New NotesDateTime(Today)
Set oriTime = New NotesDateTime(Doc.TextSysStartPlanDT(0))
Call oriTime.AdjustDay(2)
If dateTime.TimeDifference(oriTime) > 0 And Doc.TextSysStartActDT(0) = "" Then
Set Item6=AlertDoc.getfirstitem("TextSysStDt")
Call item6.appendtotextlist(Format(Doc.TextSysStartPlanDT(0),"MMM-DD-YYYY"))
Call item6.appendtotextlist(" ")
Else
Call item6.appendtotextlist(" - ")
Call item6.appendtotextlist(" ")
End If
Else
Call item6.appendtotextlist(" - ")
Call item6.appendtotextlist(" ")
End If
'---------------------End Checking System Test Start Date
'---------------------Checking UAT Start Date
If Doc.TextUATDt(0) <>"" Then
Set dateTime = New NotesDateTime(Today)
Set oriTime = New NotesDateTime(Doc.TextUATDt(0))
Call oriTime.AdjustDay(2)
If dateTime.TimeDifference(oriTime) > 0 And Doc.TextUATStartActDT(0) = "" Then
Set Item7=AlertDoc.getfirstitem("TextUATStDt")
Call item7.appendtotextlist(Format(Doc.TextUATDt(0),"MMM-DD-YYYY"))
Call item7.appendtotextlist(" ")
Else
Call item7.appendtotextlist(" - ")
Call item7.appendtotextlist(" ")
End If
Else
Call item7.appendtotextlist(" - ")
Call item7.appendtotextlist(" ")
End If
'---------------------End Checking UAT Start Date
'---------------------Checking Production Turnover Date
If Doc.TextProdTurnPlanDT(0) <>"" Then
Set dateTime = New NotesDateTime(Today)
Set oriTime = New NotesDateTime(Doc.TextProdTurnPlanDT(0))
Call oriTime.AdjustDay(2)
If dateTime.TimeDifference(oriTime) > 0 And Doc.TextProdTurnActDT(0) = "" Then
Set Item8=AlertDoc.getfirstitem("TextProdTOverDt")
Call item8.appendtotextlist(Format(Doc.TextProdTurnPlanDT(0),"MMM-DD-YYYY"))
Call item8.appendtotextlist(" ")
Else
Call item8.appendtotextlist(" - ")
Call item8.appendtotextlist(" ")
End If
Else
Call item8.appendtotextlist(" - ")
Call item8.appendtotextlist(" ")
End If
'---------------------End Checking Production Turnover Date
i%=i%+1
Set Doc=Docoll.GetNextDocument(Doc)
Wend
If i%>=1 Then
Set Maildoc= New NotesDocument(Db)
Maildoc.Form = "Memo"
Maildoc.Subject = "AAP Alert Report"
Maildoc.From = "AAP PMO"
Maildoc.Principal = "AAP PMO"
Maildoc.DisplayFrom = "AAP PMO"
Maildoc.tmpDisplaySentBy = "AAP PMO"
Maildoc.DisplayFrom_Preview = "AAP PMO"
Maildoc.DisplaySent = "AAP PMO"
Maildoc.tmpDisplayFrom_Preview = "AAP PMO"
Set Rtitem = New NotesRichTextItem(Maildoc, "Body" )
Rtitem.AppendText("Dears,")
Rtitem.AddNewLine(2)
Rtitem.AppendText("This is a reminder on these SR(s) for Actual Date(s). Please follow up.")
Call AlertDoc.RenderToRTItem(Rtitem)
Rtitem.AddNewLine(1)
Rtitem.AppendText("Thank you.")
Rtitem.AddNewLine(2)
Rtitem.AppendText("Best Regards,")
Rtitem.AddNewLine(1)
Rtitem.AppendText("AAP Operations")
Maildoc.Sendto="SURESH KUMAR/IN/AEIL/AAP"
Maildoc.CopyTo=srowner
Maildoc.Send(False)
End If
End If
End Forall
End Sub
==================================================
This code will checks for the certain fields based on some condition, and if the field is blank it composes a predefined document and sends the document to the recipients...
So now, About predefined document (Alert document).... To create new document, I have a form with a table with 8 labels in 1st row and 8 computed when composed fields in 2nd row...
In our agent, if any field is blank it will takes that document and appends the values into Alert document... So like that every document which is satisfying the condition will appends in a separate rows in Alert document....
So.. now the problem is, when a field value(mostly TITLE field) is more than 2 lines the alignment of the table is disrupting... It shows some thing odd...
I had tried with different options like spacing between rows (in table) in Alert Document... but in vain... Some times title can be 1 line or 2 lines or 3 lines... we can't predict...
How can i overcome this prob... Is there any ways to align it properly without using 3rd party tools... Pls help me in this regard...
Thanks
Suresh

