CopyRowsetDeltaOriginal method: Message class
Syntax
CopyRowsetDeltaOriginal(source_rowset [, record_list]);
Where record_list is a list of record names in the form:
[RECORD.source_recname1, RECORD.target_recname1
[, RECORD.source_recname2, RECORD.target_recname2]].
. .
Description
The CopyRowsetDeltaOriginal method copies rows of data that have changed from the source rowset to the like-named records and like-named fields in the message. It also copies the original value of the changed rows.
Note:
CopyRowsetDeltaOriginal copies all the like-named fields from the changed and original rows into the message. It is not copying just the changed like-named fields.
When the record names in the message and component do not match exactly, use the optional record_list to specify the records to be copied from the component into the message. The specified target records must be records in your message, while the specified source records must be records in a rowset that exists in the data buffer and is populated.
The CopyRowsetDeltaOriginal method sets the AUDIT_ACTN field in the PSCAMA table for every row in the message. The notification process can then use PSCAMA.AUDIT_ACTN to determine how to process every row that was published.
The set values match those used in audit trail processing, that is:
-
A - Row inserted.
-
D - Row deleted.
-
C - Row changed (updated), but no key fields changed. The system copies the new value to the Message rowset and the original value (see "O" below).
-
O - Prior value of changed row. The system copies the new value to the Message rowset and the original value (see "C").
-
K - Row changed (updated), and at least one key field changed. The system copies the original value to the Message rowset and the new value (see "N").
-
N - Row changed (updated), and at least one key field changed. The system copies the original value to the Message rowset and the new value (see "K").
-
"" − blank value means that nothing on that row has changed. This is the default value, and is the value used to tag the parent rows of children that have changed.
Note:
If a child row is inserted (or changed or deleted) CopyRowsetDeltaOriginal also copies the parent row (and the parent row of that row, and so on, up to the top row) so the subscriber has a full picture of the transaction. A blank value is set in the AUDIT_ACTN field for these rows to let the subscriber know they don’t have to take action; the parent rows are there for reference only.
The Audit_Action values "A", "C", "D" are set when a record is added, changed or deleted, respectively. When a row is changed, two records are created, one with an Audit_Action of "C", the other with Audit_Action value of "O". The "C" record has all the new values, while the "O" record retains the original values. In some cases such as effective-dated records, a user may change a key field value, such as Effective Date. In response to such an user action, two records are created, one with an Audit_Action value of "N", and the other with Audit_Action value "K". The "N" record has all the new values, while the "K" record retains the original values. The "N"/"K" combination is also created if both a key change and a non-key change is made on the same row of data.
The following table details the output from CopyRowsetDeltaOriginal:
| User Action | CopyRowsetDeltaOriginal Output | Comments |
|---|---|---|
|
Change a key. |
"N" and "K" rows created. |
The "K" row contains the original Key value, the "N" row, the new. |
|
Change a Key + change a Non-Key. |
"N" and "K" rows created only (that is: no "C"/"O" rows in that case). |
The Key and Non-Key Original Values are both contained in the "K" row. |
|
Change a Non-Key. |
"C" and "O" rows created. |
Original Value stored in "O" row. |
|
Add non-effective dated row. |
"A" row created. |
No additional rows created. |
|
Add effective-dated row and only 1 original effective-dated row exists. |
"A" and "O" rows created. |
"O" row contains the original effective dated row. |
|
Add effective-dated row and more than 1 original effected dated rows exist. |
"A" and "O" rows created. |
"O" row contains data from row that cursor was on when the new row was added. For example: If a rowset contains two rows (01/01/1980 and 02/02/2000), the current row is the 01/01/1980 row and the user adds a new row with today's date. The original values contain the data from the 01/01/1980. Likewise, if a rowset contains two rows (01/01/1980 and 02/02/2000), the current row is the 02/02/2000 row and the user adds a new row with today's date. Then the original values contain the data from the 02/02/2000. |
|
Delete a row |
"D" row created. |
No additional rows created. |
When you use the CopyRowsetDeltaOriginal method to copy the contents from the source rowset to the message object, you are creating a unique copy of the object. If you change the original rowset, the message object is not changed.
Note:
You can execute CopyRowsetDeltaOriginal against a message only once. After a message is populated, any other CopyRowsetDeltaOriginal PeopleCode statements are ignored. If you have to populate different levels of a message rowset separately, you can use the CreateRowset method to create a rowset that has the same structure as your message, populate the created rowset, then use CopyRowsetDeltaOriginal to populate your message. You can also use the Rowset CopyTo method to populate a message rowset, then populate the PSCAMA record manually.
Parameters
| Parameter | Description |
|---|---|
|
source_rowset |
Specifies the name of the rowset to be copied into the message object. |
|
record_list |
Specifies source and target records to be copied into the message object. The target records must be records in your message, while the source records must be records in a rowset that exists in the data buffer and is populated. |
Returns
None.
Example
Function Update_Dir(&MSGName As string)
&MSGName = "OPERATION." | &MSGName;
&MSG = CreateMessage(@(&MSGName));
&PnlRowset = GetLevel0();
&MSG.CopyRowsetDeltaOriginal(&PnlRowset);
%IntBroker.Publish(&MSG);
End-Function;