CopySetupRowset method: Component Interface class

Syntax

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

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

RECORD.source_recname, RECORD.target_recname 

Description

The CopySetupRowset method is used to copy a setup table 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.

The CopySetupRowset method copies like-named record fields. 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 works in PeopleCode only. 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:

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

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

The following example would be in your Notification PeopleCode.

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 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.CopySetupRowset(&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();
End-For;