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

Who am I?

Feeds

Archives

June 2025 (2)
April 2025 (1)
January 2025 (1)
December 2024 (1)
November 2024 (2)
October 2024 (2)
September 2024 (1)
July 2024 (1)
May 2024 (2)
April 2024 (3)
March 2024 (1)
February 2024 (2)
January 2024 (5)
December 2023 (3)
November 2023 (2)
October 2023 (1)
September 2023 (4)
June 2023 (1)
April 2023 (3)
March 2023 (1)
February 2023 (1)
July 2022 (1)
September 2021 (1)
August 2021 (2)
May 2021 (1)
February 2021 (3)
January 2021 (1)
November 2020 (1)
October 2020 (2)
September 2020 (2)
March 2020 (1)
November 2019 (1)
August 2019 (1)
July 2019 (1)
March 2019 (1)
December 2018 (1)
November 2018 (1)
October 2018 (1)
September 2018 (1)
May 2018 (1)
January 2018 (1)
December 2017 (1)
November 2017 (1)
September 2017 (1)
March 2017 (2)
February 2017 (5)
November 2016 (1)
September 2016 (4)
April 2016 (1)
March 2016 (7)
January 2016 (1)
December 2015 (1)
November 2015 (3)
August 2015 (1)
July 2015 (2)
June 2015 (5)
May 2015 (5)
March 2015 (3)
February 2015 (2)
January 2015 (4)
December 2014 (3)
November 2014 (1)
September 2014 (4)
August 2014 (1)
May 2014 (4)
April 2014 (1)
March 2014 (2)
February 2014 (3)
January 2014 (2)
October 2013 (1)
September 2013 (1)
August 2013 (2)
July 2013 (2)
March 2013 (2)
February 2013 (4)
January 2013 (3)
December 2012 (2)
November 2012 (1)
October 2012 (2)
September 2012 (4)
August 2012 (3)
July 2012 (1)
June 2012 (6)
May 2012 (1)
February 2012 (2)
January 2012 (1)
December 2011 (4)
November 2011 (2)
September 2011 (1)
May 2011 (2)
March 2011 (1)
January 2011 (1)
November 2010 (5)
October 2010 (2)
September 2010 (2)
August 2010 (1)
July 2010 (3)
June 2010 (1)
Previous Document Next Document

Opening another mail file is causing Type mismatch in method CoerStrToNum: STRING found, DOUBLE expected

Thomas Hampel
 7 January 2015

Problem:
Opening the mail file of another person is causing the message "Type mismatch in method CoerStrToNum: STRING found, DOUBLE expected" to be displayed:
Image:Opening another mail file is causing Type mismatch in method CoerStrToNum: STRING found, DOUBLE expected
While IBM Technote 1303181 only provides a basic idea of what is wrong, it does not give any idea what can be done to fix it.
So I had to look into details and quickly found the problem.

Steps to reproduce

In order to reproduce the problem, this is what you have to do:
  • Make sure you have the Notes.ini variable CHECK_QUOTA_ON_MAIL_CREATE set to 1
  • Open another person's mail file, this will write the current date at the end of the Notes.ini variable DELEGATED_MAIL_FILEx
  • Close your Notes client
  • Change the date format of your operating system from DD.MM.YYYY to MM/DD/YYYY (or the other way around)
  • Open the same other persons mail file again.

Analysis

Trying to find the root cause with debugging enabled shows a different error "*CE39918+421: Type mismatch"
Image:Opening another mail file is causing Type mismatch in method CoerStrToNum: STRING found, DOUBLE expected
but at least it indiicates the problem is located in the Database Open script.
Image:Opening another mail file is causing Type mismatch in method CoerStrToNum: STRING found, DOUBLE expected

What is causing this problem?

Obviously it is a String to Date conversion issue. Storing a Date in a String to convert it back to a date is never a good idea. If you really need to do it you should not rely on the CDat function to work. Write your own function which does ignore the
Regional settings - in specific the date format - of this workstation have been changed.

Resolving the problem

Change the date format of your operating system back to what it should be.
If the date format of your computer is correct and the problem still persists, then manually update your Notes.ini and remove all lines starting with DELEGATED_MAIL_FILE or by updating the date format at the end of this line yourself.

Permanent solution

A perfect solution would require to update the mail template to be updated. in specific the script Library "CheckQuotas" contains a class called "CheckQuota" with the Sub "SetCalMgrINI"
This sub contains several references where a string is being converted to a date. This is where additional verification is required to ensure the string value is a date which can be converted using the current regional settings.
Image:Opening another mail file is causing Type mismatch in method CoerStrToNum: STRING found, DOUBLE expected
Tagged with: Code Error Notes
Comments

1.) Comment

Lars Berntrop-Bos http://www.bleedyellow.com/blogs/ScriptLars 09/01/2015 13:42:27

Proposed new sub: writes all dates in iso8601 format.

Sub SetCalMgrINI

If db.Server <> "" Then

Dim servName As New NotesName(db.Server)

Dim retStr As String

Dim tmpDate As String

Dim oldestDate As String

Dim idxOldestDelegated As Integer

Dim idxDelegated As Integer

Dim strToday As String

Const iso8601date = "yyyy-mm-dd"

Const INI_VAR = "DELEGATED_MAIL_FILE"

Const MAX_DELEGATED = 35

Dim nmCom As String

idxDelegated = 1

retStr = Me.getEnvStr(INI_VAR & idxDelegated)

strToday = Format$(Today, iso8601date)

nmCom = ownerName.Common

Do While retStr <> ""

tmpDate = StrRightBack(retStr, "_")

If Instr(1, retStr, nmCom, 5) = 1 Then ' found common name (was <>0, but given format below, should be 1!)

If tmpDate <> strToday Then ' set date if not today in ISO8601

Call Me.setEnv(INI_VAR & idxDelegated, nmCom + "_" + servName.Abbreviated + "!!" + db.FilePath + "_" + strToday)

End If

Exit Sub 'found, so exit

End If

' Store oldest date

If tmpDate Like "####-##-##" Then ' Is found Date iso?

If oldestDate = "" Or tmpDate < oldestDate Then ' is oldest empty or earlier than current

oldestDate = tmpDate

idxOldestDelegated = idxDelegated

End If

Else ' if not iso, mark it as oldest

idxOldestDelegated = idxDelegated

End If

idxDelegated = idxDelegated + 1

If idxDelegated > MAX_DELEGATED Then ' if max reached, overwrite oldest found

idxDelegated = idxOldestDelegated

Exit Do

End If

retStr = Me.getEnvStr(INI_VAR & idxDelegated)

Loop

Call Me.setEnv(INI_VAR & idxDelegated, nmCom + "_" + servName.Abbreviated + "!!" + db.FilePath + "_" + strToday)

End If

End Sub

2.) Untitled

Richard Luijten http:// 12/01/2015 18:09:30

Today I had this problem as well.

A user that is a a business trip changed the regional settings from German(Austria) to English (Malaysia).

As soon as the quota check for delegated mail check is done the error occurs.

I have fixed this by sending the user a button that deleted the DELEGATED_MAIL_FILE entries from the notes.ini

Dim Session As New NotesSession

Dim MailName As String

Dim i As Integer

For i=1 To 35

MailName = Strleft(Session.GetEnvironmentString("DELEGATED_MAIL_FILE" & i, True),"_")

Call Session.SetEnvironmentVar("DELEGATED_MAIL_FILE" & i , "", True)

If MailName <> "" Then

Call Session.SetEnvironmentVar(MailName & "_LastMailDbSize","",True)

Call Session.SetEnvironmentVar(MailName & "_LastMailDbWarningQuota","",True)

Call Session.SetEnvironmentVar(MailName & "_LastMailDbMaxQuota","",True)

End If

Next

Thomas Hampel, All rights reserved.