What does the error "Function Requires a Valid ADT Argument" indicate?

Technote (troubleshooting)


Problem

When using a Lotus Notes client, or a Lotus Domino server, to execute LotusScript code, the following error occurs:


"Function Requires a Valid ADT Argument"


Cause

This error occurs when a LotusScript function or method is supplied a parameter that does not evaluate to the expected object value - it has been passed an invalid argument. Some reasons this error could occur would be because the object was not set, it was deleted or moved, or it was incorrectly specified in an earlier reference.


For example, if the NotesDocument object referenced in the following Getnextdocument call had been deleted, then it would return the noted error:


Set doc = col.getnextdocument(doc)


For example, if the NotesDateTime object returndate is not given a value, then the following call to TimeDifference would return the noted error:

  • Dim dateTime As New NotesDateTime( "" )
    Call dateTime.SetNow
    Dim returndate As NotesDateTime
    Call datetime.TimeDifference(returndate)

Resolving the problem

The acronym ADT stands for Abstract Data Type. The "function" in most contexts where this error occurs is a LotusScript method, or function, and the "Abstract Data Type" that it is looking for is a LotusScript data type, for example a NotesItem or NotesDocument (and so on).

In most cases, this error can be avoided by adding conditionals, or revising code logic, to ensure that an attempt to access a deleted object, or an object with a value of Nothing, is avoided.

One of the most typical occurrences of this error is relative to cases where a NotesDocumentCollection is being cycled through, and an invalid NotesDocument object is being referenced, often because documents are being deleted as part of the process. For an example of this scenario, including a suggested workaround, refer to "Error: "Function Requires a Valid ADT Argument" Running a Script" (# 1093032).

Another common case of this error is one involving the Out Of Office agent. The error can be observed in a scenario where a user is working in a local mail file replica and enabled the Out Of Office agent while disconnected (Island mode). This scenario sometimes results in the leaving and return date being unset, triggering the error.

转载自:http://www-01.ibm.com/support/docview.wss?uid=swg21316690

你可能感兴趣的:(adt,domino)