Can this be done? A view question

First some info on my form:I have a single form that servers two roles. In one role the form is refered to as a Project Document. In the other it is a Change Document.

All Change Documents are created with a button that appears on the Project Document. When the Change Document is saved it appends a doc link to the Project Document.

I am being asked to create a view that would first show all the Project Documents and below that show all related Change Documents.

Project Document

-----Change Document

-----Change Document

-----Change Document

Project Document

-----Change Document

-----Change Document

Subject: Can this be done? A view question.

Yes, this can be done. Follow these steps:

  1. On Project Document, add field “ProjUNID” that is computed when composed. Formula is @Text(@DocumentUniqueID)

  2. On Change Document, add same field, with one change…formula is itself: ProjUNID

  3. From button (or action or whatever is used to create the Change doc), have it do something like:

dim s as New NotesSession

dim ws as New NotesUIWorkspace

dim uidoc as NotesUIDocument

dim db as NotesDatabase

dim pdoc as NotesDocument, cdoc as NotesDocument

set db = s.CurrentDatabase

set uidoc = ws.CurrentDocument

set pdoc = uidoc.Document

set cdoc = New NotesDocument(db)

cdoc.Form = “ChangeDocument” 'or whatever the name of the form is

cdoc.ProjUNID = pdoc.UniversalID

…then save the new cdoc.

Call ws.EditDocument(True, cdoc)

I think will get you pretty close…I did this without testing it or anything.

Now the view.

First Column…hidden…sorted…formula = ProjUNID

Second Column, sorted, hidden…formula = @If(form = “ProjectDocument”;0;form = “ChangeDocument”;1;2)…this will get it sorted properly.

(note…you could add another hidden column here that sorts by @created…but I will leave that up to you)

Third Column = value from field you want to show for each , maybe the Project Name for ProjectDocuments and Description of change or date of change for ChangeDocument, with maybe the users Common Name showing. Example:

@If(

form = “ProjectDocument”;ProjectName;

form = “ChangeDocument”;" " & Description & " (" & @Name([CN];@UserName) & " added " & @Text(@Created) & “)”

See how far that gets you. If you need any more help, email me: kackster@gmail.com

Good luck.

Note how I faked the indent for ChangeDocuments. I have also made some assumptions on field names, you will have to customize that. Again, good luck.

  • Matt

Subject: Can this be done? A view question.

Trivial to make a view like that if your change documents are responses to the related project document. Off the top of my head, I can see two ways of doing that:

  1. Make the change documents use a different form from the project documents. Designate that form as a response.

  2. Use LotusScript to make the change documents responses to the related project document. Harder, but if you’ve got a bunch of existing documents, you’d have to do this anyway even if you went with option #1.

Subject: RE: Can this be done? A view question.

I wish they were responses.

I’m dealing with an old database that was never ment for this dual role functionality of a single form. It is something that has happened as an evoling process. One manager asked for this. He leaves and the next guy asks for something else. I’m new here and would love to create new forms or even a new database but that is not on my current list of projects.

Are those the only two ways you can think of doing this?

Subject: RE: Can this be done? A view question.

Creating parent-child links is by far the safest and most reliable way I can think of. I suppose it’s possible to use a hidden column to sort by whatever currently groups projects and changes together (if such a field currently exists; if it doesn’t, you’re every so slightly screwed), then use a bunch of @If statements in your column value formulae to create the appearance of a hierarchy. But that’s a lot of work for a not-very-good solution.