GetGrid function

Syntax

GetGrid(Page.page_name, grid_name, [L1_row_num])

Description

Use the GetGrid function to instantiate an object of the Grid class and populate it with the grid specified by grid_name. For grids at level 2, specify the optional L1_row_num parameter. The grid_name corresponds to the Page Field Name on the General tab of that grid’s page field properties.

Use the GetGrid function to return a reference to a Grid object. If you want to access an AnalyticGrid object, use the GetAnalyticGrid function instead.

Note:

If more than one occurs count was specified for the grid in Application Designer, GetGrid will return only the first occurrence of the grid.

Note:

PeopleSoft builds a page grid one row at a time. Because the Grid class applies to a complete grid, you can’t attach PeopleCode that uses the Grid class to events that occur before the grid is built; the earliest event you can use is the Activate event for a page.

See PeopleCode Developer’s Guide: Activate Event.

Parameters

Parameter Description

Page. page_name

Specify the name of the page definition containing the grid you want.

grid_name

Specify the Page Field Name on the General tab of the grid’s page field properties.

Specify a grid name consisting of any combination of uppercase letters, digits and "#", "$", "@", and "_".

L1_row_num

Specify the row in the parent (level 1) scroll that contains this grid. Therefore, specify this parameter for grids at level 2 only.

Note: The default value is 1.

Returns

A Grid object populated with the requested grid.

Example

This example retrieves the grid named EMPL_GRID within a scroll:

local Grid &MYGRID; 
&MYGRID = GetGrid(Page.EMPLOYEE_CHECKLIST, "EMPL_GRID");

Specifying the Grid Name

When you place a grid on a page, the grid is automatically named the same as the name of the primary record of the scroll for the grid (from the Page Field Name field) This is the name you use with the GetGrid function.

Note:

If the name of the record changes, the Page Field Name is not automatically updated. You must change this name if you want the name of the grid to reflect the name of the record.

To change a grid name:

  1. Open the page definition in Application Designer.

  2. Select the grid and access the page field properties.

  3. On the General tab, type the new grid name in the Page Field Name field.

Note:

Every grid on a page must have a unique name.