Displaying records in tabular format on a form

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.

Can any one get on this,Its urgent

Thanks

Subject: Displaying records in tabular format on a form

Hi,

there are several ways how to achive it.

  1. Create a view that displays the data you want and create your columns for AssetName …

    Make this view categorised by “EmployeeID”

    Now use a embedded view in your current form with the filter “Show only category” and the as the key use the

    employee id.

    If you really want this “in an other form” then look at the Picklist-fuctioncs that also use the filter “Show only category”

  2. Create in your form for each “column” you want to display a multi valued field that displays each value on a new line.

    Put this fields in a table and fill them with your data.

  3. Use a rich-text item where you wite all the data down using the various Append… functions.

    Afer you are done with this open this new document and display the RTF.

Hope this helps

Bye

Hynek

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 .

Regards

Subject: RE: Displaying records in tabular format on a form

Hi,

all of the solutions will work in a separete “form” as well.

If you want to print it then the embedded view is not good for printing.

The solution with multivalue fields is limited by the size of each field (32 Kb).

I would suggest to try the rtf-field.

  • Create a new document with a new rtf-field

  • use the NotesRichtextItem - methods like “AppendText”,AppendTab, AppendStyle …

to ceate you output.

  • Open the document …

You can do much more with RTFs now and you could even create a table and place each

value into the proper cell for better formatting.

Bye

Hynek

Subject: Can u give me the code

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.

Can you please give the code

Regards

Subject: RE: Can u give me the code

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:

  1. 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

Subject: Not able to get exact placing of values

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)

Subject: RE: Can u give me the code

Hi

I am not sure but I remember something seen like this in a redbook

http://publib-b.boulder.ibm.com/redbooks.nsf/RedbookAbstracts/sg246854.html?Open - IRC