Re: Putting collection in a table

How can i put a collection of documents in a table with each row giving details of each document

Subject: Re: Putting collection in a table

It depends on where your table is located.

How and where is your table exactly?

In an Excel file, it’s just a question of reading each document in your collection and, for each document, changing to the next line in Excel.

On HTML, you could produce such a table by producting the HTML code for the header, then for all document in the collection, producing the HTML code for a line, then finaly producing the footer code.

On a Notes document, however, a table is static, so you would need to create it in advance with enough lines to handle all your documents and with one field for each table cell… so that you can fill up the fields. Not a very elegent solution! Then again, that is the very reason in a Notes database, documents are displayed in a view, not in a table.

What are you trying to do exactly?

Subject: RE: Re: Putting collection in a table

Hi

I am trying to do a bus reservation system, so depending upon date, source and destination i would like to get availability of buses satisfying the conditions. So each time a table must be given as output that has field values of those documents that satisfy the requirements. Please give me a solution for this.

Thanking You in advance

Subject: RE: Re: Putting collection in a table

Well, assuming each bus data is recorded into a separate document, what you need is only a list of documents, not a table.

Even if tehre are a few data you want to display for each document, it would be more like a report.

Here is how I would handle this:

  • Create a form A to represent one single line of data:

A field for origin

A field for source

A field for the bus number

A field for bus name

All the fields in a one line table.

Set the form not to display in any menu

  • Create a form B to represent a bus search result:

A Rich Text Field for the body

Some decoration (title, and so on)

SaevOptions computed when composed to “0” to prevent saving

  • In your script, once you have your collection of document, you follow these steps:

a) Create a new document in your db

b) Assign it to form B

c) Create a new rich text item on that document

For each document in the collection:

d) Create a new temporary document in your db

e) Assign it to form A

f) Fill in the fields from the current document of your collection in that temporary document: source, origin, etc.

g) Compute with form to make sure any formula is also set

h) Call a RenderToRTItem to take a snapshot of your “line” of data from form A and append it into the body field from form B

i) Possibly, call an AppendLink to add a link to the current document into the RTF, so that a user will be able to click to go to the document

j) Call an update to refresh the rich text field in your doc B

Set your next document from collection and loop through all your collection, appending the rendering of each line of data into the target RTF.

Finaly:

k) Call workspace.EditDocument to display form B as the final search result.

Hoping this gives you a few clues :slight_smile:

Nicolas Abesdris