Description

The Index.Open subroutine is an alternative to the Open statement to open an OpenInsight table. In spite of its name, Index.Open can open any OpenInsight table.

Syntax

Index.Open (OI_table_name, filevar)

Parameters

The Index.Open subroutine has the following parameters:

ParameterDescription
OI_table_nameThe name of the OpenInsight table to be open.
filevarThe variable to contain the file variable information for the opened table, after a successful Index.Open. If Index.Open is not able to open the table, filevar will be unassigned.

Returns

If successful, filevar will contain the file variable corresponding to OI_table_name. Use the assigned() function to test for success or failure of Index.Open. See example below.

See also

Open statement

Example

/* reads rows in CUSTOMERS table, displaying the last name of each customer */
 
declare subroutine index.open
declare function msg
index.open ( 'CUSTOMERS', customer_filevar)
if assigned(customer_filevar) then
  index.open  ('DICT.CUSTOMERS', @dict)
  if assigned(@dict) then
  select customer_filevar
  done = 0
  loop
    readnext @id else done = 1
  until done
    read @record from customer_filevar, @ID then
      /* process record - can use {} */
      retval = msg (@window , 'Last name = ' : {LNAME})
    end
  repeat
  end
end 
  • No labels