Record functions

Record

Information

Function Description
Record.FieldCount Returns the number of fields in a record.
Record.HasFields Returns true if the field name or field names are present in a record.

Transformations

Function Description
Record.AddField Adds a field from a field name and value.
Record.Combine Combines the records in a list.
Record.RemoveFields Returns a new record that reorders the given fields with respect to each other. Any fields not specified remain in their original locations.
Record.RenameFields Returns a new record that renames the fields specified. The resultant fields will retain their original order. This function supports swapping and chaining field names. However, all target names plus remaining field names must constitute a unique set or an error will occur.
Record.ReorderFields Returns a new record that reorders fields relative to each other. Any fields not specified remain in their original locations. Requires two or more fields.
Record.TransformFields Transforms fields by applying transformOperations. For more more information about values supported by transformOperations, see Parameter Values.

Selection

Function Description
Record.Field Returns the value of the given field. This function can be used to dynamically create field lookup syntax for a given record. In that way it is a dynamic verison of the record[field] syntax.
Record.FieldNames Returns a list of field names in order of the record's fields.
Record.FieldOrDefault Returns the value of a field from a record, or the default value if the field does not exist.
Record.FieldValues Returns a list of field values in order of the record's fields.
Record.SelectFields Returns a new record that contains the fields selected from the input record. The original order of the fields is maintained.

Serialization

Function Description
Record.FromList Returns a record given a list of field values and a set of fields.
Record.FromTable Returns a record from a table of records containing field names and values.
Record.ToList Returns a list of values containing the field values of the input record.
Record.ToTable Returns a table of records containing field names and values from an input record.

Parameter Values

The following type definitions are used to describe the parameter values that are referenced in Record functions above.

MissingField option MissingField.Error = 0;

MissingField.Ignore = 1;

MissingField.UseNull = 2;
Transform operations Transform operations can be specified by either of the following values:

A list value of two items, first item being the field name and the second item being the transformation function applied to that field to produce a new value.

A list of transformations can be provided by providing a list value, and each item being the list value of 2 items as described above.

For examples, see description of Record.TransformFields
Rename operations Rename operations for a record can be specified as either of:

A single rename operation, which is represented by a list of two field names, old and new.



For examples, see description of Record.RenameFields.