NotesDatabase Search Problem

I’m having a really strange behavior. I have an “when new mail arrives” trigered agent, the subject of the mail contains a code that corresponds to a document in the database (“code” is not the UNID), so, I get the code and make a Database Search like this

set docCol = db.search(|Form=“sarlanga” & dode=“|+code+|”|, nothing, 0)

the problem is that the above line does not finds any documents (docCol.count=0), I already try puting all the documents pending (form=“sarlanga”) ordered by code in the first column and try using view.getDocumentByKey. The same problem take place, the agent is unable to find the documents.

Other info related with the problem.

*- The Agent runs with the id of the server, wich have all the roles and is manager over the database.

Any one knows if there is a bug related with this problem? I couldn’t find anything in the in the fix database or in the forum.

ANY idea for a work arround or know why this extrange behabior is taking place wll be apreciated.

TIA.

Subject: NotesDatabase Search Problem

there are a few things that would cause this kind of problem -

1)readers fields - I assume you’ve checked this based on how you describe the ACL

2)case sensitivity - text fields are case sensitive when the db is searched in this way - this includes the form field in my experience.

3)Is code really a text field? looking for text in a numeric field will not get you what you want.

Subject: RE: NotesDatabase Search Problem

negative, the “code” field is text, the readers field is full checked, the server can see them, in fact, the agent runs smoothly a few days ago.

Subject: RE: NotesDatabase Search Problem

There is nothing wrong with your code as best I can tell. The problem is that no documents match your query. Why this might be the case, I couldn’t begin to guess without more information. The first thing I suggest, every time it appears that a function is not working, is this: check the inputs to that function. It may be that the variables you’re passing it don’t have the values you think they have.