1

Re: Could not convert variant of type (Null) into type (String)

Can anyone shed any light on the following:

After doing a large import into a copy of 6.13.3.182 trying to “display unchecked records” or view observations generates an error message as follows:

date/time         : 2009-04-28, 17:00:39, 781ms
computer name     : B029742
user name         : Barry
operating system  : Windows XP Service Pack 3 build 2600
system language   : English
system up time    : 9 hours 54 minutes
program up time   : 28 seconds
processor         : Intel(R) Pentium(R) 4 CPU 3.00GHz
physical memory   : 1100/2046 MB (free/total)
free disk space   : (C:) 15.45 GB
display mode      : 1600x1200, 32 bit
process id        : $3e8
allocated memory  : 15.31 MB
command line      : RecorderApp.exe /198254
executable        : RecorderApp.exe
exec. date/time   : 2008-11-04 09:45
version           : 6.13.3.182
madExcept version : 2.7h
exception class   : EOleException
exception message : Could not convert variant of type (Null) into type (String).
main thread ($b24):
007af9ee RecorderApp.exe DialogContainer   98 TdlgContainer.bbOkClick
004b4048 RecorderApp.exe Controls             TControl.Click
004a9160 RecorderApp.exe StdCtrls             TButton.Click
004a9254 RecorderApp.exe StdCtrls             TButton.CNCommand
004b3eb0 RecorderApp.exe Controls             TControl.WndProc
004b6f0f RecorderApp.exe Controls             TWinControl.WndProc
004a9024 RecorderApp.exe StdCtrls             TButtonControl.WndProc
004b3c80 RecorderApp.exe Controls             TControl.Perform
004b7047 RecorderApp.exe Controls             DoControlMsg
004b769f RecorderApp.exe Controls             TWinControl.WMCommand
004b3eb0 RecorderApp.exe Controls             TControl.WndProc
004b6f0f RecorderApp.exe Controls             TWinControl.WndProc
004b6b8c RecorderApp.exe Controls             TWinControl.MainWndProc
004528d8 RecorderApp.exe Classes              StdWndProc
7e4292de user32.dll                           SendMessageW
7e42a993 user32.dll                           CallWindowProcA
004b6ff3 RecorderApp.exe Controls             TWinControl.DefaultHandler
004b4450 RecorderApp.exe Controls             TControl.WMLButtonUp
004b3eb0 RecorderApp.exe Controls             TControl.WndProc
004b6f0f RecorderApp.exe Controls             TWinControl.WndProc
004a9024 RecorderApp.exe StdCtrls             TButtonControl.WndProc
004b6b8c RecorderApp.exe Controls             TWinControl.MainWndProc
004528d8 RecorderApp.exe Classes              StdWndProc
7e4196c2 user32.dll                           DispatchMessageA
004d4de3 RecorderApp.exe Forms                TApplication.ProcessMessage
004d4e1a RecorderApp.exe Forms                TApplication.HandleMessage
004d1989 RecorderApp.exe Forms                TCustomForm.ShowModal
00915e14 RecorderApp.exe FormActions     1253 TdmFormActions.RunAction
00915ce0 RecorderApp.exe FormActions     1228 TdmFormActions.ExecuteComAction
00451c23 RecorderApp.exe Classes              TBasicAction.Execute
004bf301 RecorderApp.exe ActnList             TContainedAction.Execute
004bffa3 RecorderApp.exe ActnList             TCustomAction.Execute
00451af7 RecorderApp.exe Classes              TBasicActionLink.Execute
004c5a7f RecorderApp.exe Menus                TMenuItem.Click
004c6d33 RecorderApp.exe Menus                TMenu.DispatchCommand
004c7aba RecorderApp.exe Menus                TPopupList.WndProc
004c7a09 RecorderApp.exe Menus                TPopupList.MainWndProc
004528d8 RecorderApp.exe Classes              StdWndProc
7e4196c2 user32.dll                           DispatchMessageA
004d4de3 RecorderApp.exe Forms                TApplication.ProcessMessage
004d4e1a RecorderApp.exe Forms                TApplication.HandleMessage
004d503a RecorderApp.exe Forms                TApplication.Run
0099f832 RecorderApp.exe RecorderApp      317 initialization

Charles Roper
Digital Development Manager | Field Studies Council
http://www.field-studies-council.org | https://twitter.com/charlesroper | https://twitter.com/fsc_digital

2

Re: Could not convert variant of type (Null) into type (String)

Hi Charles

I can't help much with this, but the error message shows that the error came from within the Display Unchecked Records addin. Maybe JNCC can have a quick look? It sounds like the addin is expecting a string value in one of your fields which is unusually null.

Best Wishes

John van Breda
Biodiverse IT

3

Re: Could not convert variant of type (Null) into type (String)

Thanks John. I asked for them to uninstall that addin but they still get the error when opening the Obs hierarchy:

date/time         : 2009-04-29, 16:19:35, 578ms
computer name     : B029742
user name         : Barry
operating system  : Windows XP Service Pack 3 build 2600
system language   : English
system up time    : 1 day 9 hours
program up time   : 1 minute 9 seconds
processor         : Intel(R) Pentium(R) 4 CPU 3.00GHz
physical memory   : 892/2046 MB (free/total)
free disk space   : (C:) 15.21 GB
display mode      : 1600x1200, 32 bit
process id        : $bc8
allocated memory  : 15.51 MB
command line      : RecorderApp.exe /199206
executable        : RecorderApp.exe
exec. date/time   : 2008-11-04 09:45
version           : 6.13.3.182
madExcept version : 2.7h
exception class   : EVariantTypeCastError
exception message : Could not convert variant of type (Null) into type (String).

main thread ($410):
00437613 RecorderApp.exe Variants          VarCastError
0043b51a RecorderApp.exe Variants          @VarToLStr
00798730 RecorderApp.exe Observations 1669 TfrmObservations.PopulateSurveyLevel
0079422c RecorderApp.exe Observations  507 TfrmObservations.Create
0091405b RecorderApp.exe FormActions   518 TdmFormActions.DisplayForm
00914166 RecorderApp.exe FormActions   568 TdmFormActions.actObservationsExecute
00451c23 RecorderApp.exe Classes           TBasicAction.Execute
004bf301 RecorderApp.exe ActnList          TContainedAction.Execute
004bffa3 RecorderApp.exe ActnList          TCustomAction.Execute
00451af7 RecorderApp.exe Classes           TBasicActionLink.Execute
004c5a7f RecorderApp.exe Menus             TMenuItem.Click
004c6d33 RecorderApp.exe Menus             TMenu.DispatchCommand
004c7aba RecorderApp.exe Menus             TPopupList.WndProc
004c7a09 RecorderApp.exe Menus             TPopupList.MainWndProc
004528d8 RecorderApp.exe Classes           StdWndProc
7e4196c2 user32.dll                        DispatchMessageA
004d4de3 RecorderApp.exe Forms             TApplication.ProcessMessage
004d4e1a RecorderApp.exe Forms             TApplication.HandleMessage
004d503a RecorderApp.exe Forms             TApplication.Run
0099f832 RecorderApp.exe RecorderApp   317 initialization

Charles Roper
Digital Development Manager | Field Studies Council
http://www.field-studies-council.org | https://twitter.com/charlesroper | https://twitter.com/fsc_digital

4

Re: Could not convert variant of type (Null) into type (String)

Hi Charles

You probably need Dorset Software to confirm what is happening on line 1669 of the Observations file - it should give you a clue as to what attribute is wrong.

Best Wishes,

John van Breda
Biodiverse IT

5

Re: Could not convert variant of type (Null) into type (String)

We shall wait to hear from Dorset with great anticipation (I presume they're reading this?)...

Charles Roper
Digital Development Manager | Field Studies Council
http://www.field-studies-council.org | https://twitter.com/charlesroper | https://twitter.com/fsc_digital

6 (edited by SimonWood 01-05-2009 09:01:32)

Re: Could not convert variant of type (Null) into type (String)

Hi Charles,

It sounds like a data issue somewhere.  Firstly can you please try toggling the "Organise Surveys By Tag" option to see if you still receive the same issue.

I've managed to obtain the same issue as yourself by 'fiddling' the Organisation field in the Name table for the user entity which ran a survey. Below is a query that will identify any surveys where there may be an issue with the person who ran it.

SELECT     SU.Survey_Key,
    SU.Item_Name,
    CASE N.Organisation
        WHEN 0 THEN CASE WHEN I.Forename IS NULL THEN I.Surname ELSE I.Forename + ' ' + I.Surname END
        WHEN 1 THEN O.Full_Name
        ELSE ''
    END as RunBy                
FROM        Survey          SU    
JOIN        Name            N    ON    N.Name_Key        =    SU.Run_By
LEFT JOIN   Individual      I    ON    I.Name_Key        =    N.Name_Key
                                  AND  N.Organisation    =    0
LEFT JOIN   Organisation    O    ON    O.Name_Key        =    N.Name_Key
                                  AND    N.Organisation    =    1
WHERE     CASE N.Organisation
        WHEN 0 THEN CASE WHEN I.Forename IS NULL THEN I.Surname ELSE I.Forename + ' ' + I.Surname END
        WHEN 1 THEN O.Full_Name
        ELSE ''
    END is Null

Hope this helps identify the issue.

Simon Wood
[url=http://www.dorsetsoftware.com/]Dorset Software Services[/url]

7

Re: Could not convert variant of type (Null) into type (String)

Simon, many thanks for this.

We ran the query and it returned a result:

For survey THU000020000006E Runby is blank

Does this mean that "Run By" person wasn't exported and thus couldn't import at the other end?

Would this cause the import to crash? (Recorder crashed during import, not just after the import)

Would the best short-term fix be to manually export the person who is causing the problem?

Charles

Charles Roper
Digital Development Manager | Field Studies Council
http://www.field-studies-council.org | https://twitter.com/charlesroper | https://twitter.com/fsc_digital

8

Re: Could not convert variant of type (Null) into type (String)

Hi Charles,

It does indeed sound like that is the case.  I'm not sure how what type of import you've used but it does sound like the individual or organisation record has not been imported into your database.  We've carried out some work in this area for the forth coming release but it sounds like this area might be worth double checking.

For a quick fix, if you have access to the database backend then it might be worth changing the Run By key in the Survey table for the specified Survey to a name key that does exist.  The Observation hierarchy should then open up ok and you'll be able to change the Run By field manually.  Alternatively you could indeed try your method of exporting the individual manually and importing their record.

Simon Wood
[url=http://www.dorsetsoftware.com/]Dorset Software Services[/url]

9

Re: Could not convert variant of type (Null) into type (String)

Thanks Simon.

The original export was based on a large polygon a report and exported in NBNData (Zipped) format.

What I ended up doing to fix the obs hierarchy crashing was to export the Individual that is causing the crash in NBNData (XML) format. On importing this Individual at the other end, the obs hierarchy stopped crashing. So it seems that this is a problem related specifically to issues with the NBNData (Zipped) format not exporting properly (which I believe are discussed elsewhere).

If you like I can provide a test copy of our database with the polygons I used for the report so that you can reproduce the problem exactly. Or I could provide a copy of the XML export of the Individual to test against.

Charles Roper
Digital Development Manager | Field Studies Council
http://www.field-studies-council.org | https://twitter.com/charlesroper | https://twitter.com/fsc_digital