4D View v16

PV GET LAST ERROR

Home

 
4D View v16
PV GET LAST ERROR

PV GET LAST ERROR 


 

PV GET LAST ERROR ( area ; errorCode ; errorText ) 
Parameter Type   Description
area  Longint in 4D View area
errorCode  Longint in Error number
errorText  Text in Error description text

The PV GET LAST ERROR command gets information on the last error for the specified 4D View area. If the area reference is equal to 0, the information will correspond to the last error received from all 4D View areas.

After execution of the command, errorCode receives the error number and errorText contains the detailed description of the corresponding error. The numbers and names of errors generated by 4D View are provided in Appendix A, List of 4D View error codes.

PV GET LAST ERROR only returns an error if the last call of a 4D View command for area provoked an error: any call to a command that does not provoke an error re-sets the last error to zero. To intercept and handle errors that may arise, use the PV ON ERROR command instead.

However, when you do not use the PV ON ERROR command, 4D View displays an alert dialog box to user in case of an error. It will then be possible to get the necessary information, for example in the 4D Debugger, using the PV GET LAST ERROR command.

Example  

After loading values of a selection of records in a 4D View area, check to see if the available memory was sufficient to complete the operation without bogging it down. If not, offer the user a suggestion on how to fix this.

 C_LONGINT($ErrorCode//Error number
 C_TEXT($ErrorText//Text description of error
 
 PV FIELD TO CELLS(Area;1;1;1;0;Table(->[Clients]);Table(->[Clients]);Field(->[Clients]FirstName))
 PV FIELD TO CELLS(Area;1;2;1;0;Table(->[Clients]);Table(->[Clients]);Field(->[Clients]Name))
 PV GET LAST ERROR(Area;$ErrorCode;$ErrorText//Was there an error?
 If($ErrorCode=18) //Insufficient memory
    ALERT("Insufficient memory: decrease the selection to display or give "+"4D more memory.")
 End if



See also 

Appendix A, List of 4D View error codes
PV ON ERROR

 
PROPERTIES 

Product: 4D View
Theme: PV Area
Number: 15990

 
HISTORY 

Created: 4D View 6.8

 
ARTICLE USAGE

4D View Language ( 4D View v16)