How create dynamic table for statistic

Hi,I must do statistic in my project.

I have a list of people save in another database and for all I must do statistic of their differents form that they had done so I want created a dynamic table and fill it with all people.

I’m newbie and I don’t know to do that.

Can you help me, please

Subject: How create dynamic table for statistic

Following subroutine will create a dynamic table with 3 cols.cDoc is document in which you create the table

tDoc is external document with statistics data

Body is the RichText field to generate the table

Field_1, Field_2 and Field_3 are external multivalue fields in tDoc with statistics.

Sub RTCreateTable(cDoc As NotesDocument, tDoc As NotesDocument)

Dim Sess As New NotesSession

Dim RTI As NotesRichTextItem

Dim RTS As NotesRichTextStyle

Dim RTPS(1 To 3) As NotesRichTextParagraphStyle

Dim RTN As NotesRichTextNavigator

Dim i As Integer

Dim Rows As Integer

Dim Cols As Integer

Dim Item As NotesItem



Set Item = tDoc.GetFirstItem("Field_1")



Rows = Ubound(Item.Values)

Cols = 3



If Rows = 1 And Item.Values(0) = "" Then

	Call cDoc.Save(True, False)

	Exit Sub

End If



Set RTI = New NotesRichTextItem(cDoc, "Body")

Set RTPS(1) = Sess.CreateRichTextParagraphStyle

RTPS(1).LeftMargin = 0

RTPS(1).FirstLineLeftMargin = 0

RTPS(1).RightMargin = RULER_ONE_CENTIMETER * 7



Set RTPS(2) = Sess.CreateRichTextParagraphStyle

RTPS(2).LeftMargin = 0

RTPS(2).FirstLineLeftMargin = 0

RTPS(2).RightMargin = RULER_ONE_CENTIMETER * 7



Set RTPS(3) = Sess.CreateRichTextParagraphStyle

RTPS(3).LeftMargin = 0

RTPS(3).FirstLineLeftMargin = 0

RTPS(3).RightMargin = RULER_ONE_CENTIMETER * 1.7



Call RTI.AppendTable(Rows +1, Cols,, RULER_ONE_INCH * 1.5, RTPS)



Set RTS = Sess.CreateRichTextStyle

RTS.NotesFont = 4

RTS.FontSize = 8

RTS.Bold = True

Call RTI.AppendStyle(RTS)



Set RTN = RTI.CreateNavigator

Call RTN.FindFirstElement(RTELEM_TYPE_TABLECELL) 

Call RTI.BeginInsert(RTN)

Call RTI.AppendText("Head 1")

Call RTI.EndInsert

Call RTN.FindNextElement(RTELEM_TYPE_TABLECELL)



Call RTI.BeginInsert(RTN)

Call RTI.AppendText("Head 2")

Call RTI.EndInsert

Call RTN.FindNextElement(RTELEM_TYPE_TABLECELL)



Call RTI.BeginInsert(RTN)

Call RTI.AppendText("Head 3")

Call RTI.EndInsert

Call RTN.FindNextElement(RTELEM_TYPE_TABLECELL)



RTS.Bold = False

Call RTI.AppendStyle(RTS)



For i = 0 To Rows

	Call RTI.BeginInsert(RTN)

	Call RTI.AppendText(tDoc.Field_1(i))

	Call RTI.EndInsert

	Call RTN.FindNextElement(RTELEM_TYPE_TABLECELL)

	

	Call RTI.BeginInsert(RTN)

	Call RTI.AppendText(tDoc.Field_2(i))

	Call RTI.EndInsert

	Call RTN.FindNextElement(RTELEM_TYPE_TABLECELL)

	

	Call RTI.BeginInsert(RTN)

	Call RTI.AppendText(tDoc.Field_3(i))

	Call RTI.EndInsert

	Call RTN.FindNextElement(RTELEM_TYPE_TABLECELL)

Next



Call RTN.FindNextElement(RTELEM_TYPE_TABLECELL)

Call RTN.FindNextElement(RTELEM_TYPE_TABLECELL)



Call cDoc.Save(True, False)

End Sub