NotesAgent RunOnServer produces "error: type mismatch"

An agent should run of the function “runOnServer” on the server.Besides, data about a Parameterdokuent are exchanged.

The involved agents, masks and librarys are signed with sam users who also have all required rights.

In the agent’s call function there is a error handler. Also an examination of the return value of the function “RunOnServer” exists.

The whole notes-database-sourcecode can be compiled without any errors.

Error:

The agent can be determined. The function “runOnServer” leaves in the log.nsf only:

21.07.2010 12:40:33 Agent ‘’ error: Type mismatch

There is no error generated, and also the return value of the function “runOnServer” is 0.

The following was already tried (because to find on the Internet):

pNotesDatenbank. IsOpen = true

Print Typename (notes_agent) = NOTESAGENT

Print Datatype (notes_agent) = 35

Furthermore this behaviour appears only with some agents. Some agents in the same databese use the same logig for running background

agent and function without mistake. Everything already functioned once, the strange behaviour was found during the last days.

Now I look for some more ideas.

Subject: error handling

Do you have any error handling in the agent itself?

Runonserver will return 0 if the agent is able to run, not if it ran without an error.

Just print the line number of the error in the agent to the log and check that code

Subject: Problem Solved … but

In every background-agent i had a boolean variable to tell if i wanted to save the log. Due to some optimizations I changed that from a constant TRUE or FALSE to a String. Looked like this:

Dim KNZ_SAVE_LOG As String

Private Sub wl( pString As String )

If ( KNZ_SAVE_LOG ) Then '<-- HERE ERROR; BUT NOT AT COMPILE TIME (GRRRRRRRR)

	log_String = log_String & Chr( 13 ) & Format( Now, "hh:nn:ss" ) & "  "  & pString

End If



Print pstring

End Sub

After I removed the line, all works fine. And yes, in the background agent there are also error-handlers (ok, not in die sub wl (which stands for “write log”)).

This must be an error at compile time. A quick reference in VB6 shows also no Error at compile time.

I want it to look like this in Java:

String my_string = "here";



if ( my_string ) 

{

  System.out.println("toll");

}

which results in a complie error “Type mismatch: cannot convert from String to boolean”

Subject: LotusScript If takes an integer value - not boolean.

So e.g. if your string contained text that could be converted to a number, the if statement works. It’s not a syntax error.