Programmatic server connection checking

Visual LANSA Framework

Programmatic server connection checking

#avFrameworkManager.avCheckConnection method is available in filter and command handler code.

It should be used to check the server connection within a command handler or filter just prior to performing an operation that will use the connection (for example a search or save).

Invoking this method causes the server check function to be called on the server, so it is advisable to consider, and verify by testing, the performance ramifications of how often you invoke it. For example, invoking it in every iteration of a loop that inserts 100 database rows would be ill advised.   

Method: avCheckConnection

Parameters:

Name Usage Class Description Default

Server

Input - Optional

Alpha – max length 32

The server to check (user object name/type of the server)

Current Server

AttemptReconnect

Input – Optional

Boolean

If the connection is found to have failed, attempt one reconnect

TRUE

IssueMessages

Input – Optional

Boolean

Issue messages advising the user that the connection has failed

If this is set to FALSE, the ActionOnFail parameter is ignored, and no attempt is made to communicate with the user. 

TRUE

ActionOnFail

Input – Optional

Boolean

Action if the one attempt to reconnect fails. Can be ABORT or NOTIFY/RETRY

  • Abort
  • the user is advised, no further action is taken, the timer is deactivated.
  • If the user subsequently initiates avCheckConnection, another single attempt to reconnect is made.
  • Notify/Retry
  • notifies the user, waits for their instruction to try again, and then tries again, if they press OK.
  • On each loop the user can chose OK or Cancel. If they choose Cancel:
  • No further action is taken, the timer is deactivated.
  • If the user subsequently initiates avCheckConnection, the whole notify/retry cycle starts again.

 

The server value (set in the server properties)

OfflineOK

Input - Optional

Boolean

If this is TRUE and the user has never connected to this server (e.g. they are working offline, or the system has been defined to use the local database), avCheckConnection will return OK.

If this is FALSE and the user has never connected to this server, avCheckConnection will return ER

TRUE

ReturnValue

Output - Optional

Alpha – max length 2

Normally OK (now connected) or ER (not connected). But the connection testing function IIP can be coded to pass back other values

 

 

Examples