Struct variables

A struct variable is a composite variable containing fields of other Workshop-supported variable types. Nested structs are currently not supported.

Create a struct variable

A struct variable can be initialized using an Object's struct property, a function that returns a CustomType. Refer to the custom types documentation to learn more. If a field's type is not supported in Workshop, it will be ignored and omitted from the initialized variable.

Struct creation using a function

Extract a field from a struct

Widgets and variable transformation operations cannot use structs as a whole, so individual struct fields must be extracted for use. The image below shows how the string type name field is extracted from the person struct variable using an extract struct field variable transform, and then used in a Metric card widget.

Extracting a "name" field from a "person" struct

Use structs as function inputs

Struct variables can also be used as inputs to functions. When configuring a function that uses a struct as an input, the required fields of the struct input may be previewed by hovering over the Preview schema label. This enables builders to verify that the expected input schema matches that of the selected struct variable by referencing it to the struct variable's raw Current value.

An example of a struct as a function input