OnPostCopy method: AdsValidationBase class
Syntax
OnPostCopy(ADS_name, &content_list)
Description
This method will be automatically invoked for each ADS instance when ADS projects are copied or compared unless the method is overridden in the derived application class for the current ADS definition. If the method is overridden, then the overriding method from the derived class will be automatically invoked. During copy, this method is called for each object in the project immediately prior to copying the object to the database. This occurs only after OnPreCopyCompare has been called for all objects with no validation errors.
The definition of this method in the base class is an “empty implementation.”
This method should be used for validations that require SQL access to all the data that was in the project and in the target database simultaneously. If any errors are encountered and cleanup is required, updates can be performed by this method.
If this method encounters a validation error, it should invoke the ReportErrorModified method to store the error in the database so that it can be reviewed later on the Validation page.
In addition, the OnPreUpdate method can perform database updates. If severe errors are detected by this method, the current data set will not be copied and subsequent data sets will not be copied; however, any data sets already copied to the database will not be rolled back.
Parameters
| Parameter | Description |
|---|---|
|
ADS_name |
Specifies the name of the current ADS definition as a string. |
|
&content_list |
Specifies an array of integers that identify the keys of the objects in the current project for the current ADS name. To translate this array into the keys of objects, one can query the project definition tables in the target database as follows:
The fields and bind variables are defined as follows:
The keys thus retrieved are the unique keys of the top-level record in t he ADS definition. They are also keys, but generally not unique keys, of the child records in the ADS definition. Once the keys are retrieved, you can use the rowset API to validate the data. The records in the rowset can be determined from the ADS definition with the following query:
The fields and bind variables are defined as follows:
|
Returns
A Boolean value: True if post-copy compare validations succeeded, False if any errors were encountered.
Example
import PTADSDEFN:AdsValidationBase;
class AdsValidationSample extends PTADSDEFN:AdsValidationBase
method AdsValidationSample(&ProjectName As string);
method OnPostCopy(&AdsName As string, &ContentList As array of integer) Returns boolean;
end-class;
method AdsValidationSample
/+ &ProjectName as String +/
%Super = create PTADSDEFN:AdsValidationBase(&ProjectName);
end-method;
method OnPostCopy
/+ &AdsName As string +/
/+ &ContentList As array of integer +/
/* place code to validate the data just copied here */
end-method;