CopySetupRowsetDelta method: Component Interface class

Syntax

CopySetupRowsetDelta(&Rowset [, InitialRow] [, record_list]);

Where record_list is a list of record names in the form:

RECORD.source_recname, RECORD.target_recname 

Description

The CopySetupRowsetDelta method is used to copy a setup table with changed rows in an application message to a Component Interface. A setup table has the same record at level zero and level one, while a Component Interface has only a single copy of a record. This method copies the contents of the message (at level zero) to the first level collection (level one) of the Component Interface.

Note:

This method works in PeopleCode only. CopySetupRowsetDelta copies all the like-named fields from the changed row into the message. It is not copying only the changed fields.

The CopySetupRowsetDelta method copies like-named record fields, in those rows where the IsChanged property is True. If a pair of source and destination record names are given, these are used to pair up the records and data collections before checking for like-named record fields.

Note:

This method uses the names of the records in the collection, not the name you may give the collection when you create the Component Interface.

If there are blanks in source rowset or record, they are copied over to the Component Interface only if the field’s IsChanged property is set to True. Otherwise blanks are not copied.

Note:

CopySetupRowsetDelta is for a notification process, that is, with message data. As all notifications work only in two-tier mode, CopySetupRowsetDelta works only in two-tier mode.

WARNING:

CopySetupRowsetDelta uses a record's keys to locate the target row to change for all audit actions other than Add. CopySetupRowsetDelta actions (other than Add) therefore work only on rowsets that have keys that uniquely identify all rows in the rowset. Rowsets that do not distinguish between rows using a key field will be updated in an unpredictable fashion.

Parameters

Parameter Description

&Rowset

Specify an existing, instantiated rowset object that contains data.

InitialRow

Specify the initial transaction row to begin with. This parameter provides a quick way to loop through a rowset that has multiple level zero rows. The default value for this parameter is 1.

record_list

Specify source and target record names. The source_recname is the record being copied from, in the rowset object being copied from. The target_recname is the record being copied to, in the Component Interface being copied to.

Returns

None.

Example

Local ApiObject &SESSION;
Local ApiObject &PSMESSAGES;

Local ApiObject &CI;

Local Message &MSG;
Local Rowset &RS;

&SESSION = %Session;
&PSMESSAGES = &SESSION.psmessages;

&MSG = %IntBroker.GetMessage();
&RS = &MSG.GetRowset();

&CI = &SESSION.getcomponent(Component.VOL);

/** Set Business Component Properties **/
&CI.gethistoryitems = True;
/*&CI.InteractiveMode = True;*/
/*&CI.stoponfirsterror = True;*/

For &TRANSACTION = 1 To &RS.RowCount
   &CI.VOLUNTEER_ORG = &RS(&TRANSACTION).VOLNTER_ORG_TBL.VOLUNTEER_ORG.Value;
   /* note: You can achieve much better performance if you add code here to check ⇒
 if the keys are the same L0 keys as the last time through the loop and, if so,⇒
 skip the Get/Create section. */
   
   If Not &CI.create() Then
      &PSMESSAGES.DeleteAll();
      If Not &CI.get() Then
         /** Check Error Messages **/
         For &I = 1 To &PSMESSAGES.count
            &TYPE = &PSMESSAGES.item(&I).type;
            &TEXT = &PSMESSAGES.item(&I).text;
         End-For;
         Exit(1);
      End-If;
   End-If;
   If Not &CI.CopySetupRowsetDelta(&RS, &TRANSACTION) Then
      /** Check Error Messages **/
      For &I = 1 To &PSMESSAGES.count
         &TYPE = &PSMESSAGES.item(&I).type;
         &TEXT = &PSMESSAGES.item(&I).text;
      End-For;
      Exit(1);
   End-If;
   If Not &CI.Save() Then
      /** Check Error Messages **/
      For &I = 1 To &PSMESSAGES.count
         &TYPE = &PSMESSAGES.item(&I).type;
         &TEXT = &PSMESSAGES.item(&I).text;
      End-For;
      Exit(1);
   End-If;
   &CI.Cancel();