I have for example 2 columns: name and value. In another form i have 2 fields: val1 and val2. When i press the button “Search” i just need to show all the documents that have value>=val1 and value<=val2.
It may be a stupid question but i’m a newbee… Pleease help me!!!
i am trying not to limit a view but to search for something by that criteria: val1<=value<=val2, where value is the information in a form and val1 and val2 are in another form helping to build that criteria…
What you’re trying to do isn’t totally simple. It’s easier in a web application, but can be done in Notes. I’ve got an article coming out in The View – should be “on the newsstands” any day now – showing exactly how to do this.
If you can’t wait for the article (or don’t want to shell out for a reprint, in the inexplicable circumstance that you’re not a subscriber), you could download the sample application from their website now.
If you want to display such report from a Form button, Create a button and use this command to open a view. @Command([OpenView] ; “Name of the view”.
Create this “view” with a selection formula:
Form = “Form with those value fields” & value >= val1 and value<=val2. Make sure all three value, val1 and val2 are of same data type.
ie. Create a view with this selection formula so that the view will show documents with the value between val1 and val2(inclusive). And then use this view directly in navigator or can be called from a Form button as above.
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim vw As NotesView
Dim subj As Variant
Dim ws As New NotesUIWorkspace
Dim uidb As NotesUIDatabase
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim view As NotesView
Dim docCol As NotesDocumentCollection
Dim startDate As String
Dim endDate As String
Dim searchString As String
' citeste criteriul
'salveaza doc
Set uidoc = workspace.CurrentDocument
Call uidoc.Save
'citeste doc
Set db=session.CurrentDatabase
Set vw=db.GetView("vwtemp")
Set doc=vw.GetFirstDocument
subj=doc.GetItemValue("dat1")
startDate=subj(0)
subj=doc.GetItemValue("dat2")
endDate=subj(0)
'stergedoc
Set db=session.CurrentDatabase
Set vw=db.GetView("vwtemp")
Set doc=vw.GetFirstDocument
Call doc.Remove(True)
'sterge ce era in fldr
Set db = session.CurrentDatabase
Set view=db.GetView("fldr1")
Set collection = db.AllDocuments
Call collection.RemoveAllFromFolder( "fldr1" )
'incep caut
Set db = session.CurrentDatabase
Set view = db.GetView("vw1")
searchString = |SELECT (Form = "frm1") | &"&" &| (datan => @date(| & Year(startDate) & |;| &Month(startDate) & |;| & Day(startDate) & |))& (datan=< @date(| & Year(endDate) & |;| & Month(endDate) &|;| & Day(endDate) & |))|
Set docCol = db.search(searchString, Nothing,0)
Call docCol.putAllInFolder("fldr1")