Type mismatch error caused by incorrect regional settings

Today was head scratching day again. Lotus Notes 8 was raising an error message that sounds so unusual for a Lotusscript developer:

Type mismatch in method CoerStrToNum: STRING found, double expected.

The only change to the environment has been the upgrade from Notes 7 to version 8. As it turns out, there are also a few notes about this message on Google, including a rather dubvious technote from IBM.

As it turns out, the source of the issue can be found in these two lines of code.

myDate$="17/01/2008 7:17"
var=CDat(myDate$)

Interstingly enough is the error message new to version 8 of Lotus Notes, obviously raised itself by the underlaying C++/Java code. All previous code streams, including the 8 debugger are raising the familar “type mismatch” error. This might create the impression that a regression bug has been introduced in Notes 8 – which is completely false.

Anyhow, who would have expected that the whole issue has been caused by a wrong regional setting on the underlaying operating system? In this case it has been set to US (American), with a date format of mm/dd/yyyy. As there isn’t a 17th month in a year the code fails.

I guess I would leave it open for discussion whether this has been an oversight by the developer, who couldn’t imagine that his/her code would ever been run in different region or a mistake by the persons setting up the laptop to not configure the (for New Zealand) proper date format dd/mm/yyyy.

One thought on “Type mismatch error caused by incorrect regional settings

  1. I would look at the developer for this problem. not the guys installing the laptop. The problem is having the date go through a string. I don’t typically do a lot with date manipulation but when I do it always slows me down a little because I try to keep everything in Date Data Type. On the notes document.. notesdatetime.. or variants in pure LotusScript.

Leave a Reply

Your email address will not be published. Required fields are marked *