SetRecordValues()
Summary
Updates the data for a record in a view.
Syntax
SetRecordValues(string view_name, string record_handle, array fieldnames_values)
| Argument | Contents |
|---|---|
| view_name | The view whose values are changed |
| record_handle | The record to change; if null, the current record is changed |
| fieldnames_values | An array of field name-value pairs, as follows |
| Element | Type | Contents |
|---|---|---|
| 1 | String | Field name of a field to change |
| 2 | Various | The field's new value. The type depends on the field being written. A null denotes a missing value (for any type) |
Notes
-
SetRecordValues() writes the new values to their source location. Thus, fields in several different source files may be updated if the current view is a joined view.
-
A null input record_handle causes SetRecordValues() to update the current record. In this case, if there is no current record, SetRecordValues() signals an error.
-
SetRecordValues() does not change the current record.
-
If the fieldnames_values array is null, SetRecordValues() does nothing and returns immediately.
Example
SetRecordValues("Customers", null, {
{"Sales", 45000},
{"Status", "Preferred"}
})
Error Codes
| Error Type | Meaning |
|---|---|
| Error | Input record_handle is null and the view has no current record;or input record_handle is non-null but invalid; or unable to perform necessary type-conversions on some input values in the fieldnames_values array; or file writing errors (e.g., a required file is read-only) |
| NotFound | The specified view or one of the specified fields does not exist |
See Also
| Function | Summary |
|---|---|
| GetRecord() | Gets the record handle of the current record of a view |
| SetRecord() | Sets the current record of a view |
| GetRecordsValues() | Reads the values of one or more fields for a record in a view |
| GetRecordValues() | Reads the values of one or more fields for a record in a view |