RowsetCache Class Methods

In this section, we discuss the RowsetCache class methods. These methods are discussed in alphabetical order.

Syntax

Delete()

Description

Use the Delete method to delete the RowsetCache from memory. The RowsetCache must have already been created, either using the CreateRowsetCache and saving the RowsetCache, or by a user using the application.

If this method is called as part of a larger transaction, such as in the SavePreChange or SavePostChange event, the commit is tied to the commit of the outer transaction. If an error occurs in this method, the outer transaction will be rolled back.

If this method is invoked in a non-transactional PeopleCode event (such as RowInit) the commit is controlled by the regular Component Processor flow.

Parameters

None.

Returns

A Boolean value: True if the delete was successful, False if the specified RowsetCache wasn't found.

This method terminates with an error message if there was another problem.

Example

Local RowsetCache &CRS;
Local Boolean &RSLT;

&CRS = GetRowsetCache(Rowset.MyRowset);

/* do processing*/

If (&CRS <> NULL) Then
   &RSLT = &CRS.Delete();
End-If;

Syntax

Get()

Description

Use the Get method to convert a RowsetCache object into a rowset object. After using this method, you can manipulate the data in the rowset like you would any other rowset, using the regular rowset methods and properties.

Parameters

None.

Returns

A rowset object populated with the cached rowset data.

Example

Local Rowset &RS;
Local RowsetCache &CRS;

&CRS = GetRowsetCache(Rowset.MyRowset);

If (&CRS <> NULL) Then 
   &RS = &CRS.Get();
Else
   /* do error processing */
End-if;

Syntax

Save([[Rowset.]name] [, Description] [, Lang])

Description

Use the Save method to save a new or existing rowset to the cache. If a rowset of the specified name already exists, it will be replaced. Otherwise, the rowset will be added.

If this method is called as part of a larger transaction, such as in the SavePreChange or SavePostChange event, The commit is tied to the commit of the outer transaction. If an error occurs in this method, the outer transaction will be rolled back.

If this method is invoked in a non-transactional PeopleCode event (such as RowInit) the commit is controlled by the regular Component Processor flow.

Parameters

Field or Control

Definition

Rowset. name

Specify the name of the rowset to be saved to the cache. If you just specify name, you must enclose the name in quotation marks.

Description

Specify a text string describing the rowset.

Lang

Specify the language to use when saving the rowset. See the values below.

The values for the Lang parameter are:

Value

Description

%RowsetCache_SignonLang

Attempt to save the rowset to the cache using the sign-in language. However, if the base language rowset doesn't already exist in the cache, then the save to the sign-in language fails. This is because the system requires that base language data exist before related language data can be saved.

If the Lang parameter is omitted, this is the default behavior.

%RowsetCache_BaseLang

Save the rowset to the cache using the base language.

%RowsetCache_SignonOrBaseLang

Attempt to save the rowset to the cache using the sign-in language. If that fails, then save the rowset using the base language.

Returns

A Boolean value: True if the save was successful, False otherwise.

Example

The following code cashes &RS as a rowset definition.

Local RowsetCache &CRS;
Local Rowset &RS;

&CRS = GetRowsetCache(Rowset.MyRowset);

If (&CRS <> Null) Then 
   &RS = &CRS.Get();
. . . /* do processing */
Else
   /* do error processing */
End-if;

&CRS.Save();