AddRecords()

Summary

Adds one or more records to a table and sets the current record.

Syntax

record_handle = AddRecords(string view_name, array field_names, array values, array options)

Argument Contents
view_name The name of the view containing the table
field_names An array of field names to which values will be written
values An array containing one element for each new record. Each element is an array of values corresponding to the field_names array.
Option Type Contents
empty records Integer The number of empty records to add

Returns

The record handle (string) for the last new record.

Notes

  • You cannot add records to a view that is part of a joined view.

  • By default, all fields of the new records contain missing values. The values array can be used to specify non-missing field values for one or more fields.

  • Use AddRecords() or AddPoint() to add points to a standard point (.DBD) geographic file or a point Oracle Spatial layer.

  • Use AddLink() to add records to a standard line (.DBD) geographic file or a line Oracle Spatial layer.

  • Use AddNode() to add records to the node layer of a line geographic file,

  • If the empty records option is specified, the field_names and values arrays are ignored.

  • If the empty records option is specified with a value of zero (0), or if the empty records option is not specified but the values array is null, AddRecords() returns null.

Example

rh = AddRecords("Employees",
{"LNAME", "FNAME", "PAYRATE","YOB"},
{
{ "Smith", "Peter", 10.75, 1948},
{ "Jones", "Paul", 11.25, 1954},
{ "Harrison", "George", 8.75, 1953},
{ "Peterson", "Jorinda", 13.22, 1961}
}, null)
rh = AddRecords("Accident Data", null, null, {{"Empty Records", 99}})

Error Codes

Error Type Meaning
Error Invalid values in the values array; the input view does not allow addition of new records (e.g., some types of joined views and aggregate views, ODBC tables); or error writing to file (e.g., a required file is read-only, or there is not enough disk space.)
NotFound The specified view, or some of the specified fields, does not exist

See Also

Function Summary
AddRecord() Adds a record to a table and sets the current record
DeleteRecord() Deletes a record from a view
GetRecordsValues() Reads the values of one or more fields for a group of records in a view
SetRecordsValues() Writes a value or sequence of numbers into a range of cells in a view on a table