# Sub-Array Record (subArray) The normal use for the subArray record type is to obtain sub-arrays from waveform records. Setting either the number of elements (NELM) or index (INDX) fields causes the record to be processed anew so that applications in which the length and position of a sub-array in a waveform record vary dynamically can be implemented using standard EPICS operator interface tools. The first element of the sub-array, that at location INDX in the referenced waveform record, can be displayed as a scalar, or the entire subarray (of length NELM) can be displayed in the same way as a waveform record. If there are fewer than NELM elements in the referenced waveform after the INDX, only the number of elements actually available are returned, and the number of elements read field (NORD) is set to reflect this. This record type does not support writing new values into waveform records. ## Parameter Fields The record-specific fields are described below, grouped by functionality. ### Scan Parameters The subArray record has the standard fields for specifying under what circumstances the record will be processed. These fields are listed in [Scan Fields](dbCommonRecord.md#scan-fields). ### Read Parameters The subArray's input link (INP) should be configured to reference the Waveform record. It should specify the VAL field of a Waveform record. The INP field can be a channel access link, in addition to a database link. In addition, the DTYP field must specify a device support module. Currently, the only device support module is `Soft Channel`. | Field | Summary | Type | DCT | Default | Read | Write | CA PP | | ----- | -------------------------- | ------------- | --- | ------- | ---- | ----- | ----- | | INP | Input Specification | INLINK | Yes | | Yes | Yes | No | | DTYP | Device Type | DEVICE | Yes | | Yes | Yes | No | ### Array Parameters These parameters determine the number of array elements (the array length) and the data type of those elements. The Field Type of Value (FTVL) field determines the data type of the array. The user specifies the maximum number of elements that can be read into the subarray in the MALM field. This number should normally be equal to the number of elements of the Waveform array (found in the Waveform's NELM field). The MALM field is used to allocate memory. The subArray's Number of Elements (NELM) field is where the user specifies the actual number of elements that the subArray will extract. It should of course be no greater than MALM; if it is, the record processing routine sets it equal to MALM. The INDX field determines the offset of the subArray record's array in relation to the Waveform's. For instance, if INDX is 2, then the subArray will read NELM elements starting with the third element of the Waveform's array. Thus, it equals the index number of the Waveform's array. The actual sub-array is referenced by the VAL field. | Field | Summary | Type | DCT | Default | Read | Write | CA PP | | ----- | -------------------------- | ------------- | --- | ------- | ---- | ----- | ----- | | FTVL | Field Type of Value | MENU [menuFtype](menuFtype.md) | Yes | | Yes | No | No | | VAL | Value | Set by FTVL | No | | Yes | Yes | Yes | | MALM | Maximum Elements | ULONG | Yes | 1 | Yes | No | No | | NELM | Number of Elements | ULONG | Yes | 1 | Yes | Yes | Yes | | INDX | Substring Index | ULONG | Yes | | Yes | Yes | Yes | ### Operator Display Parameters These parameters are used to present meaningful data to the operator. They display the value and other parameters of the subarray record either textually or graphically. EGU is a string of up to 16 characters describing the engineering units (if any) of the values which the subArray holds. It is retrieved by the `get_units()` record support routine. The HOPR and LOPR fields set the upper and lower display limits for the sub-array elements. Both the `get_graphic_double()` and `get_control_double()` record support routines retrieve these fields. The PREC field determines the floating point precision with which to display VAL. It is used whenever the `get_precision()` record support routine is called. See [Fields Common to All Record Types](dbCommonRecord.md#operator-display-parameters) for more on the record name (NAME) and description (DESC) fields. | Field | Summary | Type | DCT | Default | Read | Write | CA PP | | ----- | -------------------------- | ------------- | --- | ------- | ---- | ----- | ----- | | EGU | Engineering Units | STRING \[16\] | Yes | | Yes | Yes | No | | HOPR | High Operating Range | DOUBLE | Yes | | Yes | Yes | No | | LOPR | Low Operating Range | DOUBLE | Yes | | Yes | Yes | No | | PREC | Display Precision | SHORT | Yes | | Yes | Yes | No | | NAME | Record Name | STRING \[61\] | No | | Yes | No | No | | DESC | Descriptor | STRING \[41\] | Yes | | Yes | Yes | No | ### Alarm Parameters The subarray record has the alarm parameters common to all record types. [Alarm Fields](dbCommonRecord.md#alarm-fields) lists the fields related to alarms that are common to all record types. ### Run-time Parameters These fields are not configurable by the user. They are used for the record's internal processing or to represent the current state of the record. The NORD field holds the number of elements that were actually read into the array. It will be less than NELM whenever the sum of the NELM and INDX fields exceeds the number of existing elements found in the source array. BPTR contains a pointer to the record's array. | Field | Summary | Type | DCT | Default | Read | Write | CA PP | | ----- | -------------------------- | ------------- | --- | ------- | ---- | ----- | ----- | | NORD | Number elements read | LONG | No | | Yes | No | No | | BPTR | Buffer Pointer | NOACCESS | No | | No | No | No |