View : "Show multiple Categories"

I’ve read a lot of topics about applying dynamics filter to a view. I know that changing the selection formula is really uneffective and I’m looking for a way to sub-filter the documents of a view considering some dynamic parameters. @SetViewInfo won’t do what I need since a need several keys instead of one.

Concretely, I have some document sorted by there parent ID. I want to show several documents from several parents, so the option “show single category” in an embedded view won’t do the thing for me, I would really need a “Show multiple categories” option. (Btw, I need an embedded view). I saw the function FTSearch() in notesview and I’d like to know if there’s a way to use this function on the UI… or anything that would give the same result. In the same direction, if I could use the “Search this view” action programmaticly, that would be perfect.

Thank you for your answers!

Subject: View : “Show multiple Categories”

It sounds like you are trying to build a small query engine. I did this awhile ago, using two forms both with their SaveOptions set to 0. My query form consists of the ability to set beginning and ending date creation parameters, along with another layer of filtering for existing models,(the primary field I am using for sorting documents in all of the views). The existing models are a dynamic list combobox built from a view with @unique applied to the field via a categorized column, then accessed via @dbcolumn in the field’s choice selection formula. Once I populate the field values mentioned, I click the “Run Query” button…the next form has a rich text field. The button creates a back-end document, a notes rich text item, and an integer to count the number of documents matching the search criteria. These are the same elements that the second form contains. Anyway it is all wrapped in a frameset, so the result will display contained in the lower portion of the window. HTH.

Sub Click(Source As Button)

Dim session As New NotesSession

Dim workspace As New NotesUIWorkspace  

Dim db As NotesDatabase



Dim newsletter As NotesNewsletter

Dim doc As NotesDocument

Dim parseDoc As NotesDocument

Dim nextDoc As NotesDocument

Dim resultDoc As NotesDocument

Dim uidoc As NotesUIDocument

Dim nuidCurDoc As NotesUIDocument





Dim v As NotesView

Dim entry As NotesViewEntry

Dim entrytwo As NotesViewEntry

Dim vc As NotesViewEntryCollection

Dim nav As NotesViewNavigator

Dim collection As NotesDocumentCollection



Dim count As Integer

Dim total As Integer

Dim inx As Integer



Dim temp As Variant



Dim getSpecModel As String

Dim displayBeg As String

Dim displayEnd As String



Dim rtitem As NotesRichTextItem

Dim begItem As NotesItem

Dim endItem As NotesItem

Dim item As NotesItem

Dim getDocCreated  As NotesItem



Dim beginDateTime As NotesDateTime

Dim endDateTime As NotesDateTime 	

Dim compareDocCreated As NotesDateTime

'…set value of doc…

count = 0

total = 0

Set db = session.CurrentDatabase

Set v = db.GetView("(Model Sorts)")

Set uidoc = workspace.CurrentDocument 

Set doc = workspace.CurrentDocument.Document



Set resultDoc = New NotesDocument(db)

Set begItem = doc.GetFirstItem( "beginningDate" )

Set beginDateTime = begItem.DateTimeValue

Set endItem = 	doc.GetFirstItem( "endingDate" )

Set endDateTime = endItem.DateTimeValue

displayBeg = Cstr(doc.beginningDate(0))

displayEnd = Cstr(doc.endingDate(0))



'if timedifference parameter to the left is greater than parameter to the right

'being greater than zero will flag it as such 

If beginDateTime.TimeDifference(endDateTime) > 0 Then

	Messagebox "The end time that you entered is less than the begin time. Please revise.", 16, "Error"

	Exit Sub		

End If

'assign the displayForm

resultDoc.Form = "DateCollection"

Set rtitem = resultDoc.createRichTextItem("allLinks")	

'establish connection to the first document in the sorted view...get a count on the total collection before date filter is applied

'retrieve the model requested in the ui form	

getSpecModel = doc.parseModelNum(0)

Set vc = v.GetAllEntriesByKey(getSpecModel)

If vc Is Nothing Then

	Messagebox "No quotations exist referencing this item.  It may have been deleted", 0 + 16,  "Quotation does not exist"

	Exit Sub		

End If

	

inx = 1



'since these documents are categorized using a multi-value field, using the NotesViewEntryCollection classes to iterate through the docs  

'generates a item has been removed error.  We must use the NotesViewNavigator to perform these tasks.  To control iteration,

'we will use the total count from the NotesViewEntryCollection object as the sentinel value 

Set nav = v.CreateViewNavFromCategory(getSpecModel)

Set entry = nav.GetNth(inx)

If Not entry Is Nothing Then

	Set parseDoc = entry.Document

	If parseDoc Is Nothing Then

		Messagebox "This quotation does not exist", 0 + 16,  "Quotation does not exist"

		Exit Sub

	Else

		Set getDocCreated = parseDoc.GetFirstItem("dateCreated")

		Set compareDocCreated = getDocCreated.DateTimeValue

		Call  rtitem.AppendText( "This is a list of all quotations containing model " & getSpecModel & " found between dates : " & displayBeg & " - " & displayEnd)

		Call  rtitem.AddNewLine( 1 )

		Call  rtitem.AddNewLine( 1 )

		If (compareDocCreated.TimeDifference(beginDateTime) >= 0) And (compareDocCreated.TimeDifference(endDateTime) < 0) Then

			Call  rtitem.AppendText( "Document Link: " )

			Call rtitem.AppendDocLink( parseDoc, db.Title )

			Call rtitem.AddNewLine( 1 )

			Call  rtitem.AppendText( "Document Information: " )

			Call rtitem.AddNewLine( 1 )

			Call  rtitem.AppendText( "Account: " )

			Call  rtitem.AppendText( parseDoc.Account( 0 ) )

			Call rtitem.AddNewLine( 1 )

			Call  rtitem.AppendText( "Contact Name: " )

			Call rtitem.AppendText( parseDoc.Contact( 0 ) )

			Call  rtitem.AddNewLine( 1 )

			Call  rtitem.AppendText( "Date Created: " )

			Call rtitem.AppendText( parseDoc.dateCreated( 0 ) )

			Call  rtitem.AddNewLine( 1 )

			Call  rtitem.AppendText( "Confidence Level: " )

			Call rtitem.AppendText( parseDoc.ConfidenceLevel( 0 ) & " %")

			Call  rtitem.AddNewLine( 1 )

			Call  rtitem.AppendText( "Projected Order Date: " )

			Call rtitem.AppendText( parseDoc.ProjOrderDate( 0 ) )

			Call  rtitem.AddNewLine( 1 )

			Call  rtitem.AddNewLine( 1 )

			total = total + 1

			Call resultDoc.Save( False, True )

		End If

		inx = inx + 1

	End If	

End If

Set entryTwo = nav.GetNth(inx)

If Not (entryTwo Is Nothing)Then

	While inx <= vc.Count

		Set nextDoc = entryTwo.Document

		Set getDocCreated = nextDoc.GetFirstItem("dateCreated")

		Set compareDocCreated = getDocCreated.DateTimeValue

		If (compareDocCreated.TimeDifference(beginDateTime) >= 0) And (compareDocCreated.TimeDifference(endDateTime) < 0) Then

			Call  rtitem.AppendText( "Document Link: " )

			Call rtitem.AppendDocLink( nextDoc, db.Title )

			Call rtitem.AddNewLine( 1 )

			Call  rtitem.AppendText( "Document Information: " )

			Call rtitem.AddNewLine( 1 )

			Call  rtitem.AppendText( "Account: " )

			Call  rtitem.AppendText( nextDoc.Account( 0 ) )

			Call rtitem.AddNewLine( 1 )

			Call  rtitem.AppendText( "Contact Name: " )

			Call rtitem.AppendText( nextDoc.Contact( 0 ) )

			Call  rtitem.AddNewLine( 1 )

			Call  rtitem.AppendText( "Date Created: " )

			Call rtitem.AppendText( nextDoc.dateCreated( 0 ) )

			Call  rtitem.AddNewLine( 1 )

%REM

			Call  rtitem.AppendText( "Confidence Level: " )

			Call rtitem.AppendText( parseDoc.GetItemValue("ConfidenceLevel") & " %")

			Call  rtitem.AddNewLine( 1 )

			Call  rtitem.AppendText( "Projected Order Date: " )

			Call rtitem.AppendText( parseDoc.ProjWinDate( 0 ) )

			Call  rtitem.AddNewLine( 1 )

%ENDREM

			Call  rtitem.AddNewLine( 1 )

			total = total + 1

			Call resultDoc.Save( False, True )

		End If  

		inx = inx + 1

		Set entryTwo = nav.GetNth(inx)			

	Wend	

End If

Call workspace.SetTargetFrame("bottom")

doc.saveoptions = "0"

resultDoc.Total = total

Call uidoc.Close

Call workspace.EditDocument(True, resultDoc, False)

End Sub

Subject: RE: View : “Show multiple Categories”

This would be a good solution, but the way we wanted to show this was like a real view, with the document link on a dbl-clk and everything. We will probably only show a single category at a time instead. Since I don’t really need a range of document(ie between 2 dates), but only the documents corresponding of 1 of the 3 keys specified, we will put a combo box to choose the category to show. This is probably the closest solution we’re able to make with Notes.

Thank you for the try.