I am working in Notes Client R6.5.In the application I have a form where I enter a Employee ID and on a button click I want second form to get created where all the assets that employee holds shall be shown in “tabular format” at run time(for eg.2st column Asset Name 2nd column Asset details etc.).I am able to get the required data but want to presen it in proper format.
Subject: RE: Displaying records in tabular format on a form
Thanks for the solution but I want to print those records so I want them to be shown saparate form and that too in proper format.Do you have any solution .
Thanks for the solution.I have done this using richtext table etc.but I am not able to put ‘Asset Name’ and ‘Asset Description’ in two different columns of a table.
Following logic I’ve used…
I am getting all documents for that employee in a document collection and in while loop I am trying to present it.But not able to put in proper format.
Sorry but I dont have an exact code for your application.
Thats from the help file and comes very close to what you want to achieve:
This view action creates a basic auto-width table of 4 rows and 3 columns, and populates it.
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
REM Create document with Body rich text item
Dim doc As New NotesDocument(db)
Call doc.ReplaceItemValue(“Form”, “Main topic”)
Call doc.ReplaceItemValue(“Subject”, “Table 4 x 3”)
Dim body As New NotesRichTextItem(doc, “Body”)
REM Create table in Body item
rowCount% = 4
columnCount% = 3
Call body.AppendTable(rowCount%, columnCount%)
REM Populate table
Dim rtnav As NotesRichTextNavigator
Set rtnav = body.CreateNavigator
Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
For iRow% = 1 To 4 Step 1
For iColumn% = 1 To 3 Step 1
Call body.BeginInsert(rtnav)
Call body.AppendText("Row " & iRow% & ", Column " & iColumn%)
Call body.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Next
Next
REM Save document and refresh view
Call doc.Save(True, False)
Dim ws As New NotesUIWorkspace
Call ws.ViewRefresh
End Sub
Thnx for this,I already tried this code from help so I am getting values but not able to put them in proper cells of the table.As apart from those two ‘for’ loops there’s one more ‘while’ loop to get documents values.So i want to know the exact position of this ‘while’ loop in the code.The code that I’ve done is given below
Dim sess As New NotesSession
Dim db As NotesDatabase
Dim wsp As New NotesUIWorkspace
Dim toolview As NotesView
Dim empview As NotesView
Dim empdoc As NotesDocument
Dim toolcoll As NotesDocumentCollection
Dim tooldoc As NotesDocument
Dim printdoc As NotesDocument
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim empname As String
Set db=sess.CurrentDatabase
Set uidoc=wsp.CurrentDocument
Set doc=uidoc.Document
If uidoc.EditMode = False Then
uidoc.editmode = True
End If
'Set empview=db.GetView("EMPV")
Set toolview=db.GetView("WithEmp")
'///Get all tools with this employee
Set toolcoll=toolview.GetAllDocumentsByKey(doc.EmpNo(0))
'Set empdoc=empview.GetDocumentByKey(Cint(doc.EmpNo(0)))
'If Not empdoc Is Nothing Then
' empname=Cstr(empdoc.EmpName(0))
'End If
Set tooldoc=toolcoll.GetFirstDocument
'///Create a print document
Set printdoc=db.CreateDocument
printdoc.form="PrintEmpTools"
printdoc.EmpNo=doc.EmpNo(0)
printdoc.EmpName=doc.EmpName(0)
printdoc.DocID=printdoc.UniversalID
doc.DocID=printdoc.UniversalID
Dim hold As String
Set rtitem1 = New NotesRichTextItem(printDoc, "Content")
rowCount% = toolcoll.Count
columnCount% = 1
Call rtitem1.AppendTable(rowCount%, columnCount%)
Dim rtnav As NotesRichTextNavigator
Set rtnav = rtitem1.CreateNavigator
Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
For iRow% = 1 To toolcoll.Count Step 1
For iColumn% = 1 To 1 Step 1
While Not tooldoc Is Nothing
Call rtitem1.BeginInsert(rtnav)
Call rtitem1.AppendText(tooldoc.TDesc(0) & " - - - - - " & tooldoc.TDetail(0) )
Call rtitem1.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Set tooldoc=toolcoll.GetNextDocument(tooldoc)
Wend
Next
Next
Call printdoc.Save(True,True)