Sample Communication Record.
Note: from the base class, default values:
|Subject||Wrapper Class Attribute||Default value|
|Name of Message Field||
|Name of Notification Field||
|Notification code: Initiated||
|Notification code: Exception||
|Notification code: Data Error||
||N (not loaded)|
|Notification code: Loaded||
||Y (data loaded)|
These can be modified in your subclass's constructor, after calling the super constructor, but you need to make sure your Application Engine and communication record match.
Sample Data Staging Record
Note: If you are loading data from an external system, you probably don't want to add any validation/prompts to the staging record. Let the Component Interface handle validation logic instead.
Reset the staging record.
A step to reset the staging record may be useful if you want to run the Application Engine and give users the option to correct and re-try data loads.
UPDATE PS_TCI_SOURCE SET SET_NOTIFY_FLAG = 'S' ,MESSAGE_TEXT_254 = ' ' WHERE SET_NOTIFY_FLAG NOT IN ('Y', 'B', 'D') ;
In this case, S is the "Staged for loaded" code, Y means that the data was loaded already. B means user-initiated Block and D means Delete mode.
The wrapper class does not have to know about all these codes, it only needs to know what codes your code expect from it.
Fetch by Do-while loop:
%Select(EMPLID, AE2CIAET.SET_NOTIFY_FLAG) SELECT EMPLID , CASE SET_NOTIFY_FLAG WHEN 'D' THEN 'D' ELSE 'I' END FROM PS_TCI_SOURCE /* S stands for staged here */ WHERE SET_NOTIFY_FLAG IN ('S','D') ORDER BY EMPLID ;
The AE Section doing the actual load:
Warning: watch the On Error and make sure the updMsg step always runs, otherwise a Do-While might run infinitely.
sql to update the staging record
UPDATE PS_TCI_SOURCE SET MESSAGE_TEXT_254 = %Bind(AE2CIAET.MESSAGE_TEXT_254), SET_NOTIFY_FLAG = %Bind(AE2CIAET.SET_NOTIFY_FLAG) WHERE EMPLID = %Bind(EMPLID)
Remember: up to now, the status code and notification are only in the AET communication record. This step writes them to the database, after any commit/rollbacks.
Sample unit testing screen for this batch.
No, it's not going to win any cosmetic prizes. But take a a look at the Status and Results columns - these are error straight from the CI or even peoplecode errors.