Row Class Methods

In this section, we discuss each Row class method. The methods are discussed in alphabetical order.

Syntax

CopyTo(&row) 

Description

The CopyTo method copies from the row executing the method to the specified target row, copying like-named record fields and subscrolls at corresponding levels. The target Row object must be from a "related" rowset—that is, built from the same records—but it can be under a different parent at higher levels.

This method copies all the records from the Row object executing the method to the target Row object, not just the primary data record associated with the rowset.

In order to copy all of the properties of the fields from the source row, the source and target scrolls must have exactly the same shape:

  • The names of the records in the source and target scrolls must be the same.

  • If there are subscrolls in the source scroll, then the same number of subscrolls must exist in the target scroll.

  • The names of the records in any source subscrolls and target subscrolls must be the same.

Parameters

Field or Control

Definition

row

Specify a target row. This must be a Row object, not a row number.

Returns

None

Example

The following example copies rows from a child rowset (DERIVED_HR) to the current rows.

Local Row &ROW;
Local Rowset &RS1;

&RS1 = GetRowset();
For &I = 1 to &RS1.ActiveRowCount
   &ROW = GetRowset(SCROLL.DERIVED_HR).GetRow(&I);
   &ROW.CopyTo(GetRow(&I));
End-For;

Syntax

GetNextEffRow()

Description

The GetNextEffRow method finds the row, in the same rowset as the row executing the method, that has the next effective date (when compared to the row executing the method.)

Parameters

None

Returns

A row object. If there is no row with a later effective date, this method returns a null object.

Example

&ROW2 = &ROW.GetNextEff();

If &ROW2 <> NULL Then
   &TMP = &ROW2.RowNumber;
   /* other processing */
Else
   /* no effective dated row - do error processing */
End-if;

Syntax

GetPriorEffRow()

Description

The GetPriorEffRow method finds the row, from the same rowset as the row executing the method, that has the prior effective date to the row executing the method.

Parameters

None

Returns

A row object. If there is no row with a prior effective date, this method returns a null object.

Example

&TMP = &ROW.GetPriorEffrow().RowNumber;

Syntax

GetRecord({n | RECORD.recname})

Description

The GetRecord method creates a record object that references the specified record within the current row object. This is the default method for a row object. This means that any row object, followed by a parameter list, acts as if GetRecord is specified.

Parameters

Field or Control

Definition

n | RECORD.recname

Specify a record to be used for instantiating the record object. You can specify either n or RECORD.recname, Specifying n creates a record object for the nth record in the row. This might be used if writing code that needs to examine all records in a row without being aware of the record name. Specifying RECORD.recname creates a record object for the record recname.

Note: There is no way to predict the order the records will be accessed. Use the n option only if the order in which the records are processed doesn’t matter.

Returns

A record object.

Example

The following example gets a record, then assigns the name of the record to the variable &TMP:

&REC = &ROW.GetRecord(RECORD.QEPC_LEVEL1_REC);

&TMP = &REC.NAME;  /* note that NAME is a property of the record class */

Because GetRecord is the default method for a row, the following code is identical to the previous:

&REC = &ROW.QEPC_LEVEL1_REC;

&TMP = &REC.NAME; 

The following example loops through all the records for a row:

Local rowset &LEVEL1;
Local row &ROW;
Local record &REC;

&LEVEL1 = GetRowset(SCROLL.EMPL_CHECKLIST);
For &I = 1 to &LEVEL1.ActiveRowCount
   &ROW = &LEVEL1.GetRow(&I);
   For &J = 1 to &ROW.RecordCount
      &REC = &ROW.GetRecord(&J);
         /* do processing */
   End-For;
End-For;

The following function takes a rowset and a record, passed in from another program. GetRecord won’t take a variable for the record, however, using the @ symbol you can convert the string to a component record name.

Function Get_My_Row(&PASSED_ROWSET, &PASSED_RECORD)
   
   For &ROWSET_ROW = 1 To &PASSED_ROWSET.RowCount
      &UNDERLYINGREC = "RECORD." | &PASSED_ROWSET.DBRecordName;
      &ROW_RECORD = &PASSED_ROWSET.GetRow(&ROWSET_ROW).GetRecord(@&UNDERLYINGREC);
      
      /* Do other processing */
      
   End-For;
   
End-Function;

Syntax

GetRowset({n | SCROLL.scrollname})

Description

The GetRowset method creates a rowset object that references a child rowset of the current row. scrollname must specify the primary record for the child rowset.

Parameters

Field or Control

Definition

n | SCROLL.scrollname

Specify a rowset to be used for instantiating the rowset object. You can specify either n or SCROLL.scrollname. Specifying n creates a rowset object for the nth child rowset in the row. This might be used if you are writing code that examines all rowsets in a row without being aware of the name. Specifying SCROLL.scrollname creates a rowset object for the record scrollname. scrollname must specify the primary record for the child rowset.

Note: There is no way to predict the order the rowsets will be accessed. Use the n option only if the order in which the rowsets are processed doesn’t matter.

Returns

A rowset object.

Example

&CHILDROWSET = &ROW.GetRowset(SCROLL.QEPC_LEVEL1_REC);

Syntax

scrollname(n)

Description

If scrollname is used as a method name for a row, it is used to select a child rowset and a row within that rowset.

&ROW.scrollname(n) 

acts the same as

&ROW.GetRowset(SCROLL.scrollname).GetRow(n)

Parameters

Field or Control

Definition

n

Must be a valid row number for the selected child rowset.

Returns

A row object.

Example

&SUBROW1 = &ROW.QEPC_LEVEL1_REC(1);