GetRecordValues()

Summary

Reads the values of one or more fields for a record in a view.

Syntax

values_array = GetRecordValues(string view, string record_handle, array field_names)

Argument Contents
view Name of the view
record_handle The record to read, or null for the current record
field_names An array of field specs or names of fields to read, or null for all fields

Returns

An array of field spec-value pairs. Each pair corresponds to one field and its value and has the following format:

Element Type Contents
1 String The field spec for the field
2 Various The field's value. The type depends on the field being read. A null denotes a missing value (for any type).

Notes

  • The pairs in the returned array are ordered identically to the input field_names array.

  • If the input field_names array is null, GetRecordValues() reads all fields and returns the array in the natural order of fields in the view.

  • If view_name is null, GetRecordValues() uses the current view.

  • If the input record_handle is null, GetRecordValues() reads the current record.

  • GetRecordValues() does not change the current record.

Example

//Open BDOCUMENTS\CALIPER\\< product name>\TUTORIAL\NElayers.wrkz
tutorial_folder = RunMacro("G30 Tutorial Folder")
wrkz = OpenWorkspace(tutorial_folder + "NElayers.wrkz")
rh = LocateRecord("County|", "[County Name]", {"SUFFOLK MA"}, )
vals = GetRecordValues("County", rh, {"[County Name]", "Population",
"[Per Capita Income]"})
ShowArray(vals)

Error Codes

Error Type Meaning
Error The record_handle is null and the view has no current record; or the record_handle is non-null but invalid; orGetRecordValues() encountered file reading errors.
NotFound The specified view, or one or more of the specified fields, does not exist.

See Also

Function Summary
LocateRecord() Locates a record based on the value of a field
GetRecord() Gets the record handle of the current record of a view
GetRecordsValues() Reads the values of one or more fields for a record in a view
SetRecord() Sets the current record of a view
SetRecordValues() Updates the data for a record in a view