GetColumn method: Grid class
Syntax
GetColumn(columnname)
Description
The GetColumn method instantiates a grid column object from the Grid class, and populates it with a grid column from the grid object executing this method. Specify the grid column name in the page field properties for that field, consisting of any combination of uppercase letters, digits and "#", "$", "@", and "_".
To specify a grid column name:
-
Open the page in Application Designer, select the grid and access the page field properties.
-
Select the Columns tab on the grid properties.
-
Either double-click on the grid column you want to name, or select the column and click the Properties button.
-
On the General tab, type the grid column name in the Page Field Name field.
Note:
Although it’s possible to base multiple grid columns on the same record field, the Page Field Name you enter for each grid column must be unique, not just for that grid, but for that page. If you have two grids on a page, every page field name must be unique to the page.
Parameters
| Parameter | Description |
|---|---|
|
columnname |
Specify a string containing the value of the Page Field Name on the General tab of the grid column’s properties. You must have previously entered a value for the Page Field Name for the grid column you want to work with. |
Returns
A GridColumn object populated with the grid column specified as the parameter to this method.
Example
local Grid &MYGRID;
local GridColumn &MYGRIDCOLUMN;
&MYGRID = GetGrid(PAGE.EMPLOYEE_CHECKLIST, "EMPL_GRID");
&MYGRIDCOLUMN = &MYGRID.GetColumn("CHECKLIST_ITEMCODE");
The following function loops through rows on a grid. The function finds each row that is selected. It does this through the Selected property of the Row class of PeopleCode. Data is then moved from the selected row to a new row, on a different grid, in the same page. The way in which this function is written, data is moved from &SCROLL_SHELF to &SCROLL_CART. These are two different rowset objects, of two different grids, on the same page. Note that the two grids in this example are on the same occurs level.
/* Moving data between grids on the same occurs level */
/* of the same page */
Local Rowset &SCROLL_CART, &SCROLL_SHELF;
Function move_rows(&SCROLL_CART As Rowset, &SCROLL_SHELF As Rowset);
&I = 1;
/* loop to find whether row is selected */
Repeat
If &SCROLL_SHELF.GetRow(&I).Selected = True Then
If All(&SCROLL_CART(1).GetRecord(1).QEPC_ITEM.Value) Then
&SCROLL_CART.InsertRow(&SCROLL_CART.ActiveRowCount);
End-If;
/* if it is selected move data to other grid */
&SCROLL_SHELF.GetRow(&I).GetRecord(1).CopyFieldsTo(&SCROLL_CART.GetRow⇒
(&SCROLL_CART.ActiveRowCount).GetRecord(1));
/* delete row from current grid so data disappears */
&SCROLL_SHELF.DeleteRow(&I);
&I = &I - 1;
End-If;
&I = &I + 1;
Until &I = &SCROLL_SHELF.ActiveRowCount + 1;
/* end of loop ****************************************/
End-Function;
/********* end of function *****************************/
/* Creating the rowset object */
&SCROLL_CART = GetLevel0()(1).GetRowset(SCROLL.QEPC_CART);
&SCROLL_SHELF = GetLevel0()(1).GetRowset(SCROLL.QEPC_SHELF);
/* calling the function */
move_rows(&SCROLL_CART, &SCROLL_SHELF);
Related Topics