A script-enabled browser is required for this page to function properly.

Retrieving and Storing List Elements in a Record Group

To retrieve and store (create a "snapshot" of) the contents of a List to a record group, use the RETRIEVE_LIST Built-in subprogram. Storing the contents of a List item allows you to restore the List with its former contents.

When you call RETRIEVE_LIST, you indicate which List to retrieve by specifying the List ID and the record group ID.

In order to retrieve the contents of a List into a record group, the record group must have two columns with type CHAR. Column one must contain List label values and column two must contain List element values.

Retrieving and storing List elements in a record group: Example

The following example retrieves the contents of the current List item ('List_item1') into a record group (orders), creates a two column query record group (product_names), and then populates the List item with the values from the product_names record group.

DECLARE
/*
** Create the two column non-query record group called
** orders. This record group will contain the List item
** values. Assign its id to the variable, group_id.
*/
group1_id RecordGroup;
group2_id RecordGroup
col1_id GroupColumn;
col2_id GroupColumn;
it_id Item := Find_Item('List_item1');
status NUMBER;

BEGIN
group1_id := Create_Group('orders');
/*
** Add two columns to the new group, using group1_id to
** identify the group and then retrieve the List item values
** into the record group.
*/
col1_id := Add_Group_Column(group1_id,'col1',CHAR_COLUMN,50);
col2_id := Add_Group_Column(group1_id,'col2',CHAR_COLUMN,50);

Add_Group_Row(group1_id,1);
Add_Group_Row(group1_id,2);
Retrieve_List(it_id, 'orders');
/*
** Create a two column query record group called product_names.
*/
group2_id := Create_Group_From_Query('product_names','SELECT
product.name,product.name FROM product');
status := Populate_Group('product_names');
/*
** Populate the List item with the values from the
** product_names record group.
*/
Populate_List(it_id,'product_names');
END;


Manipulating List items at runtime

RETRIEVE_LIST Built-in