Personal Blog of Thomas Hampel - Creative Mythbusting in Development and Collaboration

Who am I?

Feeds

Root Cause for ’Type mismatch in method OP_UNARY’

Thomas Hampel
 21 March 2016

Quickly creating a mail with Buttons containing LotusScript can cause headaches.
It just takes a few lines of code for running into undocumented error messages here is a small example:
Image:Root Cause for ’Type mismatch in method OP_UNARY’
will result in:
Image:Root Cause for ’Type mismatch in method OP_UNARY’

Changing "if not ..." to "is ..." like shown here
Image:Root Cause for ’Type mismatch in method OP_UNARY’
will result in a slightly different error message "Type mismatch in method IfCoerceBool: Unknown found, Uknown expected"
Image:Root Cause for ’Type mismatch in method OP_UNARY’
Do you spot the problem???

What is the root cause?

The property "IsNewDoc" acutally is a property of NotesUIDocument but is not a valid property of the NotesDocument class.
For testing if a NotesDocument is a new document, use the property IsNewNote
When creating a new button within the body of a new mail, Option Declare is not enabled by default like it is in the Designer client, so the error was not detected when saving the source code.
with Option Declare enabled its easier to spot the problem...
Image:Root Cause for ’Type mismatch in method OP_UNARY’

Reminder:
Comments [0]
Tagged with: Development Error Notes
Go ElsewhereSubscribe to RSSAboutStay ConnectedAnd More
Thomas Hampel, All rights reserved.