# Struct variables A **struct variable** is a composite variable containing fields of other Workshop-supported [variable types](../concepts-variables/index.md#variable-types). Nested structs are currently not supported. ## Create a struct variable A struct variable can be initialized statically within Workshop, using an object's struct property, or with a function that returns a `CustomType`. Refer to the [custom types documentation](../../functions/types-reference/index.md#structcustom-type) to learn more. If a field's type is not supported in Workshop, it will be ignored and omitted from the initialized variable. Struct and struct array variables can also be computed with an Ontology SQL query, where the fields are derived from the columns the query returns. Refer to the [SQL query variables](../sql-query-variables/index.md#struct-variables) documentation to learn more. Struct creation using a function ### Create a struct array variable Similarly, a struct array variable containing multiple structs can be initialized using an object's struct array property, or a function. Struct array creation using a function #### Looping over struct arrays Struct array variables may be used in loop layouts to enable more performant looping setups in applications with fewer load calls needed to display objects data, or in workflows where a builder may want to display non-ontologized data outputted with a function. To learn more about looping over arrays, refer to [loop layout documentation](../loop-layouts/index.md). ## 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](../variable-transformations/index.md), and then used in a [Metric card widget](../widgets-metric-card/index.md). ![Extracting a "name" field from a "person" struct](../../../assets/d70942fe83544b3e1ca03e607d7ff2e2e165415d5517e3a360247b7b2a20cde8.webp) ## Use structs as function inputs Struct and struct array 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.](../../../assets/5e7d4788de6258af3452fbc36a484ff46f0dc5c8796ad393b0a15554ecdcef76.webp)