Integra for Notes Banner
  QuickReports Integra4Notes Integra Family of Products

Integra Script Library Documentation


Context:

General

Library/Class:

Sample Code



Advanced error handler script explained As Integer, Read/Write

The default advanced error handler script provides a means to control what happens if a runtime error exception occurs either in Integra's runtime script libraries or any advanced formulae or script. Unlike the advanced callback formula or callback script, the error handling script requires no default structure. Simply because there is only one error event.

Using the following properties of the stats, import & export objects a profile developer can handle runtime error situations and control whether and how Integra continues its processing:

Export ProfilesImport Profiles
export.errortext
export.iserror
export.continue
stats.procstat
import.errortext
import.iserror
import.continue
stats.procstat

The code sample further down is taken from a standard profile delivered with Integra called Import / Update Contact Details. It demonstrates a typical scenario where a profile developer can make use of the advanced error handler script.

The profile allows to import contacts from an Excel spreadsheet into the personal name and address book. The profile contains advanced script that will use the NotesDatabase.GetDocumentByUNID() method to test for the existence of a to be imported contact. If a contact already exists, the contact document will be updated from any changes, otherwise a new contact is created. The document unique id required as a parameter for the NotesDatabase.GetDocumentByUNID() method is part of the data stored in the imported Excel spreadsheet. If you have played around with the NotesDatabase.GetDocumentByUNID() method, you will know that it throws a Notes exception if the passed on UNID does not exist. So we need to cater for this scenario.

The following code sample checks the error text for a particular content indicating that the NotesDatabase.GetDocumentByUNID() method is the culprit causing the error exception. If so, we simply tell Integra to continue its processing.

If instr(ucase(import.errortext),"INVALID UNIVERSAL ID") > 0 then

    ' UNID of existing contact not found

    import.errortext = ""
    ' we need to reset the error text

    import.iserror = False
    ' we need to reset iserror

    import.continue = True
    ' we need to tell Integra to continue with the current event

    stats.procstat = 1
    ' we need to tell Integra to continue looping as normal
end if


Note: an error exception caused by advanced script or advanced formula causes the script or formula execution to be terminated at the code line triggering the error exception. That means any code following the error code line will not be executed until the next (same) event occurs; regardless of whether an advanced error handling script forces Integra to continue processing or not. Any required data processing not done at this point has to be done in the error handling script. So certain code redundancy is eventually unavoidable when trying to handle runtime errors. To avoid this problem a developer may choose to use custom script libraries to use the Lotus Script On Error Goto statement to deal with exceptions. In which case the Script Error Handler field can be left blank. Please refer to the Developers Manual for more details on using Custom Script Libraries.
 
QUICK LINKS
 
 

 

  © Shireburn Software Ltd. 2008 - 2024