CreateRowset method: File class

Syntax

CreateRowset()

Description

The CreateRowset method is a file layout method. It instantiates a PeopleCode rowset object containing one unpopulated row, based on the file layout definition specified with SetFileLayout.

Note:

You must specify a file layout using the SetFileLayout method before using CreateRowset, otherwise it returns NULL.

See SetFileLayout method: File class.

After the empty rowset object has been created, you can use Rowset class methods such as Select or Fill, and built-in functions such as GetLevel0 or GetRowset, to populate the rowset with data. After the rowset contains data, you can use the method WriteRowset to write the data to a file.

Don’t use CreateRowset when reading from a file. Instead, use the ReadRowset method to instantiate and populate rowsets with data from the file.

Parameters

None.

Returns

An empty rowset object.

Example

&SOMEROWSET = &MYFILE.CreateRowset();

The following rowset is created from a file object, then populated with data using the GetLevel0 function:

&FILEROWSET = &MYFILE.CreateRowset();
&FILEROWSET = GetLevel0();
&MYFILE.WriteRowset(&FILEROWSET, True);

The following rowset is created from a file object, then populated with data using Fill method:

&FILEROWSET = &MYFILE.CreateRowset();
&NUM_READ = &FILEROWSET.Fill("where MYRECORD = :1", &UVAL);