×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

db.Search

db.Search

db.Search

(OP)
Hi guys,
I am having difficulties to get the searchFormula$ right. I need to find a COLLECTION of documents using db.Search where the FORM is called CM and field on the form is called TheMeasurement should equal TEST1

Can anybody help, Thanks
Andre

RE: db.Search

Andre,

There is a better way than db.search to collect documents in a database.  I have had problems with inaccurate results and have been told that it is common.  Here is a better way to gather your documents.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim Collection As NotesDocumentCollection
Dim doc As NotesDocument, oldDoc As NotesDocument

Set db = Session.currentdatabase
'create a hidden view name = Measurement or FormView
'first column = TheMeasurement or Form
'sort first column
Set view = db.getview("Measurement") 'or FormView

'value needs to be "CM" if you did a FormView, if you did the measurement view then it would be "Test1"

Set collection = trialview.GetAllDocumentsByKey(value)

'If you then need to step through the collection to find
'other documents that match a different criteria then:

If collection.count > 0 Then
  Set doc = collection.GetFirstDocument
  Do While Not doc Is Nothing
    Set item = doc.GetFirstItem("EventStartTime")
    requesttime = Format(item.text, "HH:MM AM/PM")
    If requesttime <= checktime Then
      amcount = amcount + 1
    Elseif requesttime > checktime Then
      pmcount = pmcount + 1
    End If
    Set olddoc = doc
    Set doc = collection.getnextdocument(olddoc)
    Delete olddoc
  Loop
End If

This looks at a collection of documents.  As long as the documentcollection isn't empty it will continue the loop.  I have gathered all the documents where the date matches my criteria.  Then I assign the value of the EventStartTime to a variable and check to see if I need to increment my AMcount or my PMcount depending on the time.  Then I assign the document to olddoc, assign the next document in the collection to doc and delete olddoc (the one I just counted) from the collection (which is how the collection eventually gets emptied!).


Leslie
landrews@metrocourt.state.nm.us

SELECT * FROM USERS WHERE CLUE > 0
No Rows Returned

RE: db.Search

(OP)
THANKS Leslie, this looks quite helpful to me
ANDRE

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close