Table Of Contents

Flatten to Byte Array (G Dataflow)

Last Modified: January 12, 2018

Converts any type of data you specify into an array of bytes.

You can also use this node to convert the byte order, or endian format, of the data in the flattened data array.

connector_pane_image
datatype_icon

anything

The data you want to convert. You can wire any data type to this input.

This input accepts arrays and clusters of Booleans, floating-point numbers, and strings. This input can also accept an array of clusters, or a cluster of arrays, of those data types. However, anything does not support refnums.

datatype_icon

prepend array or string size

A Boolean that specifies whether this node includes information about data size at the beginning of data bytes.

prepend array or string size only controls the top-level data size information. Arrays and strings in hierarchical data types such as clusters always include size information.

True Includes size information.
False Does not include size information.

Default: True

datatype_icon

byte order

The endian format of the data in the resulting output. Byte order, or endian form, indicates whether integers are represented in memory from most-significant byte to least-significant byte or vice versa. When reading a binary file, you must interpret the data in the same byte order in which the data was written.

Name Description
big-endian, network order

The most-significant byte occupies the lowest memory address. Use this endian format when reading data written on a different platform.

native, host-order

Uses the byte-ordering format of the host computer. This endian format increases read and write speed.

little-endian

The least-significant byte occupies the lowest memory address.

Default: big-endian, network order

datatype_icon

error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error

datatype_icon

data bytes

A flattened byte array that this node generates.

If prepend array or string size is True, data bytes contains header information describing its size.

datatype_icon

error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Converting Data Types without Flattening Data

Use the Type Cast node instead of Flatten to Byte Array or Unflatten from Byte Array to convert data types without flattening data.

The Flattening Behavior of Variant Data

If you want to flatten variant data, you may or may not want to flatten all of the attributes for that variant. If you want to flatten variant data and all of the variant contents, including attributes, use this node. However, if you want to only flatten the variant and discard its attributes, use the Variant To Flattened Byte Array node.

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices

Web Server: Not supported in VIs that run in a web application


Recently Viewed Topics