GetRecord function
Syntax
GetRecord([Record.REC_NAME])
Description
Use the GetRecord function to create a reference to a record object for the current context, that is, from the row containing the currently executing program.
The following code:
&REC = GetRecord();
is equivalent to:
&REC = GetRow().GetRecord(Record.recname);
or
&REC = GetRow().recname;
Note:
This function is invalid for PeopleCode programs located in events that aren't associated with a specific row and record at the point of execution. That is, you cannot use this function in PeopleCode programs on events associated with high-level objects like pages (the Activate event) or components (component events).
Parameters
With no parameters, this function returns a record object for the current context (the record containing the program that is running).
If a parameter is given, Record. REC_NAME must specify a record in the current row.
Returns
GetRecord returns a record object.
Example
In the following example, the level 2 rowset (scroll) has two records: EMPL_CHKLST_ITM, (the primary record) and CHKLST_ITM_TBL. If the code is running from a field on the EMPL_CHKLST_ITM record, the following returns a reference to that record:
&REC = GetRecord(); /*returns primary record */
The following returns the other record in the current row.
&REC2 = GetRecord(Record.CHKLST_ITM_TBL);
The following event uses the @ symbol to convert a record name that’s been passed in as a string to a component name.
Function set_sub_event_info(&REC As Record, &NAME As string)
&FLAGS = CreateRecord(RECORD.DR_LINE_FLG_SBR);
&REC.CopyFieldsTo(&FLAGS);
&INFO = GetRecord(@("Record." | &NAME));
If All(&INFO) Then
&FLAGS.CopyFieldsTo(&INFO);
End-If;
End-Function;