OPEN-RS

Function

Opens a row set.

Syntax

OPEN-RS
NAME=row_set_name_var|_lit|_col
FILENAME=file_name_var|_lit|_col

COLUMN=({name_var|_lit|_col},{type_var|_lit|_col})

Arguments

NAME

Name of the row set.

FILENAME

Name of the external file used to hold the row set.

COLUMN

Column name and data type. Can be repeated as many times as needed. The column name is case-sensitive.

Description

OPEN-RS is used to instantiate the specified row set. When executed, the specified external file is created. If it already exists, the current contents are replaced. OPEN-RS can reside in any section except BEGIN-SETUP, BEGIN-SQL, and BEGIN-DOCUMENT. Validation rules include:

The row set file is an XML file. You can define whether to create the XML file in a BI Publisher (BIP) format or an SQR format in the FormatForRowsetXML entry in the [Default-Settings] section of SQR.INI.

Example

Begin-Report
 Open-RS Name='customer' FileName='customer.xml'
  Column = ('cust_num', 'integer')
  Column = ('name', 'string')
  Column = ('addr1', 'string')
  Column = ('addr2', 'string')
  Column = ('city', 'string')
  Column = ('state', 'string')
  Column = ('zip', 'string')
  Column = ('phone', 'string')
  Column = ('tot', 'integer')
 Begin-Select
cust_num
name
addr1
addr2
city
state
zip
phone
tot
 Write-RS Name='customer'
  Value = ('cust_num', &cust_num)
  Value = ('name', &name)
  Value = ('addr1', &addr2)
  Value = ('addr2', &addr2)
  Value = ('city', &city)
  Value = ('state', &state)
  Value = ('zip', &zip)
  Value = ('phone', &phone)
  Value = ('tot', &tot)
 from customers
 order by cust_num
 End-Select
 Close-RS Name='customer'
End-Report

See Also

CLOSE-RS, WRITE-RS