# FormatOutputBuffer

The FormatOutputBuffer function Functions are tools that are available in Spreadsheet for processing and analyzing acquisitions or other results. You can add functions to your Spreadsheet job to create tool chains and produce results for specific applications. is for configuring the format of the output data. When FormatOutputBuffer is inserted in the spreadsheet, the FormatOutputBuffer dialog is automatically opened and used to program the function.

Note: The FormatOutputBuffer function has a maximum string argument length of 256 bytes.
Inputs

The FormatOutputBuffer function has the following syntax:

FormatOutputBuffer(WithErr, Format, Value1,[Value 2, ...])

See the table for a description of the available parameters.

Parameter | Description
WithErr | Specifies whether the function returns a valid buffer, even if an input error has occurred. 0 = Data is put in the buffer even if an input error has occurred (default). 1 = Function returns #ERR and no data is stored in the buffer.
Format | Specifies the Data Type and Element Size in bytes to automatically configure. The following are the available Data Types:
Data Type | Size in Bytes | Representation as Function Argument
--- | --- | ---
Bit | 1 byte | b
8-bit integer | 1 byte | i
8-bit unsigned integer | 1 byte | u
16-bit integer | 2 bytes | il
16-bit unsigned integer | 2 bytes | ul
64-bit unsigned integer | 8 bytes | uq
32-bit integer | 4 bytes | d
32-bit floating point | 4 bytes | f
String | User-defined size | sN where N is the number of bytes
Byte-swapped string | User-defined size | ~sN where N is the number of bytes
When multiple Data Types are defined in the Format parameter, the Data Types are separated by a colon in the cell expression. For example, if you configure the FormatOutputBuffer function for output data that consists of four 16-bit integers, the cell expression in the FormatOutputBuffer function cell is the following: FormatOutputBuffer(WithErr,"il:il:il:il",Value) If you edit the cell expression manually, the FormatOutputBuffer function also accepts an alternate argument format that allows you to specify an offset for each Data Type by prefixing the Data Type with a number for the offset, where 0 is the first received value. For example, if you configure the FormatOutputBuffer function to only receive the first, third, fifth, and seventh 16-bit integers in the output data, the cell expression in the FormatOutputBuffer function cell is the following: FormatOutputBuffer(WithErr,"0il:2il:4il:6il",Value) Note: The alternate argument format is only necessary when the regular argument for the output data you want to configure exceeds the 256 character limit for the function. The alternate argument format allows you to split the output data between two or more FormatOutputBuffer functions and process the whole output.
Value | Specifies a variable-length list of values.

Outputs

Returns | A Buffer data structure containing the formatted data or #ERR if any of the input parameters are invalid.