OScript API/Built-in Package Index |
The built-in functions in the RecArray package allow you to create and manipulate values of type Record and RecArray. You can think of a RecArray as a table of information where each column has a name and each row is a Record. Records and RecArrays are frequently used together. If you just need a name-value association, you may want to use an Assoc instead. Fields (or columns) in a Record or RecArray can be referenced by name or by index. Records and RecArrays use one-based indexes. Records and RecArrays are both reference data types. For more information, including an example of using Records and RecArrays, please see the OScript Language Reference.
Specifies a value of type RecArray.
Specifies a value of type Record.
Adds a field to a RecArray if a field with the specified name does not exist.
Adds a Record to the end of the RecArray.
Allocates space into which a RecArray can expand.
Returns a List containing the values stored in a RecArray column.
Duplicates a RecArray.
Creates a new RecArray.
Creates a Record containing the specified field names and values.
Removes the specified field from a RecArray.
Removes one or more Records from a RecArray.
Returns the names of the fields in the specified RecArray or Record.
Returns a List containing the values stored in the specified Record.
Inserts a Record into a RecArray at the specified position, moving all subsequent Records down.
Returns the Integer (1-based) index of a field in a Record or RecArray.
Changes the name of a field in a RecArray.
Replaces the contents of the specified Record.
Sorts a RecArray in place according to the specified fields.
Specifies a value of type RecArray.
Specifies a value of type Record.
Adds a field to a RecArray if a field with the specified name does not exist.
The RecArray to which the field will be added.
Either a String indicating the name of the field to add or a List containing String elements indicating multiple fields to add.
The index of the newly added field. If the field already exists, its index is returned. If more than one field is added, the index of the last field added is returned.
Adds a Record to the end of the RecArray.
If there are fewer elements in the values List than there are fields, the unspecified field values are set to Undefined.
If there are more elements in the values List than there are fields, the extra elements in the List are ignored.
The RecArray to which the Record will be added.
An optional List of values to add, containing one value for each field in the Record. If not specified, a Record with Undefined values is added.
The position of the added Record in the RecArray. For example, if there are four Records in the specified RecArray, the result of executing the RecArray.AddRecord function would be 5.
Allocates space into which a RecArray can expand.
This function can be used to optimize performance during RecArray creation. The most efficient procedure for filling a RecArray is to create the RecArray, use the RecArray.Allocate function to allocate space for the desired number of Records, and then add the Records.
Note that the numRecords parameters specifies the desired size of the RecArray, irrespective of any existing records. For example, if theRecArray contains five Records and you Allocate 10, the RecArray will contain 10 Records, not 15. If you Allocate the same RecArray to three Records, the RecArray will be truncated so that it contains only three Records.
The RecArray in which to pre-allocate space.
The desired size of the RecArray.
The number of records in the RecArray.
Returns a List containing the values stored in a RecArray column.
The RecArray from which to retrieve the values.
Either a String containing the name or an Integer containing the (1-based) index of the desired column.
A List of values stored in the specified column. If the colRef parameter is not a String or an Integer, if the field name is not found, or if the index is out of range, Undefined is returned. If the RecArray contains no Records, an empty List is returned.
Duplicates a RecArray.
The RecArray to duplicate.
A new RecArray, identical in format and content to the original.
Creates a new RecArray.
An optional List of String names for the fields in the RecArray. If this parameter is not specified, a RecArray with no fields or Records is created. Fields can later be specified using the RecArray.AddField function; Records can be added using RecArray.AddRecord or RecArray.InsertRecordAt, or by using the index operator ([ ]).
An optional Integer indicating the number of Records (containing Undefined field values) to add. No Records are added if this parameter is not specified.
A new RecArray.
Creates a Record containing the specified field names and values.
A List of String elements indicating the desired field names. Defaults to Undefined if not specified.
The values to be stored in the Record. The values will be inserted in the order in which they are contained in the List. Defaults to Undefined if not specified.
A new Record.
Removes the specified field from a RecArray.
The RecArray from which the field will be removed.
Either a String indicating the name or an Integer indicating the (1-based) index of the field to be dropped. If the specified field does not exist, the RecArray is not modified.
TRUE if the specified field was removed from the RecArray.
Removes one or more Records from a RecArray.
The RecArray from which you want to drop the Record(s).
The Integer (1-based) index of the first Record to drop.
The Integer (1-based) index of the last Record to drop.
TRUE if the specified Records were removed from the RecArray.
Returns the names of the fields in the specified RecArray or Record.
The Record or RecArray whose field names you want to retrieve.
A List containing String field name elements.
Returns a List containing the values stored in the specified Record.
Either a Record whose data will be returned or a RecArray from which a specified Record's data will be returned.
An Integer (1-based) index of the Record to retrieve. Specify this parameter only if the value parameter is a RecArray.
A List containing one element for each field in the specified Record.
Inserts a Record into a RecArray at the specified position, moving all subsequent Records down.
If the values parameter is a List, and too few values are passed, the remaining values in the Record are Undefined. If too many values are passed, the extra values are ignored.
If the values parameter is a Record, it should have the same format (same name and number of fields) as the RecArray into which it will be inserted. If it has a different format, a new Record is created with the proper format, and filled with values from the specified Record (the value in the first field of the specified Record is copied to the first field of the new Record, and so on). If there are too few fields in the specified Record, the new Record is padded with Undefined values. If there are too many fields in the specified Record, the extra fields are ignored.
If the value of the position parameter is greater than the length of the RecArray, Records with all Undefined values will automatically be added to the RecArray, expanding it to include the number of Records as specified by the position parameter.
The RecArray to modify.
A Record or List of values to insert.
An Integer (1-based) index indicating the desired position of the new Record.
The inserted Record.
Returns the Integer (1-based) index of a field in a Record or RecArray.
Note: it is more efficient to reference a field by its Integer index than by its String name.
TheRecord or RecArray in which to look for the field.
The field name for which to search.
The 1-based field index if found, 0 otherwise.
Changes the name of a field in a RecArray.
The RecArray containing the field to rename.
Either a String indicating the name or an Integer indicating the (1-based) index of the field to rename.
The new field name.
TRUE if the field was renamed.
Replaces the contents of the specified Record.
If the values parameter is a List, and too few values are passed, the remaining values in the Record are Undefined. If too many values are passed, the extra values are ignored.
If the values parameter is a Record, it should have the same format (same name and number of fields) as the RecArray in which it will be inserted. If it has a different format, a new Record is created with the proper format, and filled with values from the specified Record (the value in the first field of the specified Record is copied to the first field of the new Record, and so on). If there are too few fields in the specified Record, the new Record is padded with Undefined values. If there are too many fields in the specified Record, the extra fields are ignored and the specified Record is left unchanged.
If the value of the position parameter is out of range, the RecArray will not be modified and Undefined will be returned.
the RecArray or Record on which to operate.
a Record or List of values for the replacement Record.
an Integer (1-based) index of the Record to replace. Do not specify if the toReplace parameter is a Record.
The replacement Record if successful; otherwise Undefined.
Sorts a RecArray in place according to the specified fields.
The maximum number of sort values the sortVal parameter can contain is 10.
This function sorts in ascending order by default. If a negative sort index is specified, this function sorts in descending order.
The sortVal parameter can only contain Strings or Integers. If the sortVal parameter contains other data types, the RecArray does not sort and a runtime error is generated.
The RecArray to sort.
A String, Integer, or List indicating the fields by which to sort. If sortVal is a String field name or Integer field index, the RecArray is sorted by the specified column. If sortVal is a List, it can contain field names (Strings), field indices (Integers), or both.
Specifies whether the sort is case-insensitive for all String values, where TRUE indicates a case-insensitive sort.
A reference to the sorted RecArray.
Copyright © 2021 OpenText Corporation. All rights reserved. |