AddRecord()

Summary

Adds a record to a table and sets the current record.

Syntax

record_handle = AddRecord(string view_name, array values)

Argument Contents
view_name The name of the view containing the table
values An array of name-value pairs that contain field names and values

Returns

The record handle (string) for the new record.

Notes

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

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

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

  • You can also use AddRecord() to add records to a non-geographic database.

  • 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,

  • The values array is identical in format to that returned by GetRecordValues().

  • AddRecords() is much faster than repeated calls to AddRecord() when a block of records is added at one time.

Example

rh = AddRecord("Employees", {
{"LNAME", "Smith"},
{"FNAME", "Peter"},
{"PAYRATE", 10.75},
{"YOB", 1948}
})

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
AddRecords() Adds one or more records to a table and sets the current record
DeleteRecord() Deletes a record from a view
GetRecordValues() Reads the values of one or more fields for a record in a view
SetRecordValues() Updates the data for a record in a view