> For the complete documentation index, see [llms.txt](https://community-test.logicnets.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://community-test.logicnets.com/release-9/platform-documentation/process-node-parts/lua-transform.md).

# LUA Transform

## Description

This part allows you to transform one LUA structure to another based on a given schema. The schema is defined in an XML structure with a root element called “lua:schema” with at least the LUA transformation schema version attribute filled; for example, \<lua:schema version="1.0">\</lua:schema>.

The schema can have the following elements, and some elements can have child elements.

| Element                  | Description                                                                                                                                                                                                                                                                                                                                                                | Parameters                                                                                                                                                                                                                                                                          |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **lua:element**          | <p>This copies the value from the source data object or value to the target.<br>Note: This transform-schema element cannot have child transform-schema elements.</p>                                                                                                                                                                                                       | <p><strong>source</strong> input data-object path.<br><strong>value</strong> input-value.<br><strong>name</strong> target data-object path</p>                                                                                                                                      |
| **lua:table**            | <p>This processes the child transform-schema-elements on the data-object or and places the result in the target location..<br>Note: If you leave both the source and value empty the system uses the parent data object.</p>                                                                                                                                               | <p><strong>source</strong> input data-object path.<br><strong>value</strong> input-value.<br><strong>name</strong> target data-object path</p>                                                                                                                                      |
| **lua:collection**       | <p>This iterates through (the numbered and alphanumeric indexes) all child elements of the and adds the values to a collection called ..<br>If the child element is a LUA structure the system determines the resulting value by processing all child transform-schema elements first..<br>Note: If you leave the source empty the system uses teh parent data object.</p> | <p><strong>source</strong> input data-object path.<br><strong>name</strong> target data-object path<br><strong>index</strong> if set the index parameter is interpolated using the child element structure. This can be used to generate a collection with alphanumeric indexes</p> |
| **lua:unbase\*\*\*\*64** | <p>The system decodes base64 in the input data object () or value () and writes it into the result.<br>Note: This transform-schema element cannot have child transform-schema elements.</p>                                                                                                                                                                                | <p><strong>source</strong> input data-object path<br><strong>value</strong> input-value<br><strong>name</strong> target data-object path</p>                                                                                                                                        |

## Examples

Note: <lua:schema>\</lua:schema> is left out for readability.

**Inputs:**

1. { structurea = { "a", "b" }, structureb = {substructure = { b = "test", a = 1 } }}
2. { structurea = { "a", "b" }, structureb = "eyBzdWJzdHJ1Y3R1cmUgPSB7IGIgPSAidGVzdCIsIGEgPSAxIH0gfQ==" }
3. { structurea = { "a", "b" }, structureb = { { a = 1, b = "b1" }, { a = 2, b = "b2" } }, structurec = { b1 = { a = 1 }, b2 = { a = 2 } } }

| Input | Schema                                                                                                                                                                                                            | Result                                                                                                                                                                |
| ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1     | <p><a href="lua:schemaversion=&#x22;1.0&#x22;">lua:schemaversion="1.0"</a><br>\<lua:element name="structurea"source="structurea"/><br>\<lua:element name="structureb" source="structureb"/><br>\</lua:schema></p> | *Same as input* *1*                                                                                                                                                   |
| 1     | <lua:table>\<lua:element name="structurea" source="structurea"/>\<lua:element name="structureb" source="structureb"/>\</lua:table>                                                                                | *Same as input* *1*                                                                                                                                                   |
| 1     | \<lua:element name="structureb" source="structureb"/>                                                                                                                                                             | <p><em>only the</em> <em>struc\_\_tureb</em> <em>is left</em><br>{ structureb = { substructure = { b = "test", a = 1 } } }</p>                                        |
| 1     | \<lua:element name="structureb2" source="structureb"/>                                                                                                                                                            | <p><em>only the</em> <em>structureb</em> <em>is left</em> <em>and it is renamed to structureb2</em><br>{ structureb2 = { substructure = { b = "test", a = 1 } } }</p> |
| 1     | \<lua:table name="structureb2" source="structureb">\<lua:element name="substructure" source="substructure"/>\</lua:table>                                                                                         | <p><em>only the</em> <em>structureb</em> <em>is left and it is renamed to structureb2</em><br>{ structureb2 = { substructure = { b = "test", a = 1 } } }</p>          |
| 2     | <lua:table>\<lua:element name="structurea" source="structurea"/>\<lua:unbase64 name="structureb" source="structureb"/>\</lua:table>                                                                               | *Same as input 1*                                                                                                                                                     |
| 3     | <lua:table>\<lua:collection name="col" source="structurea"/>\</lua:table>                                                                                                                                         | { col = { "a", "b" } }                                                                                                                                                |
| 3     | \<lua:collection name="col" source="structureb">\<lua:element name="a" source="a"/>\</lua:collection>                                                                                                             | { col = {{ a = 1}, { a = 2 } }}                                                                                                                                       |
| 3     | \<lua:collection name="col" source="structureb" index="$(b)"><lua:table>\<lua:element name="a" source="a"/>\</lua:table>\</lua:collection>                                                                        | { col = { b1 = { a = 1}, b2 = { a = 2 } }}                                                                                                                            |
| 3     | \<lua:collection name="col" source="structurec">\<lua:element name="a" source="a"/>\</lua:collection>                                                                                                             | { col = { { a = 1}, { a = 2 } }}                                                                                                                                      |

## Editor Fields

The following fields control the configuration of this part.

| Tab   | Field Name            | Description/Use                                                            | Type   | Optional/Mandatory |
| ----- | --------------------- | -------------------------------------------------------------------------- | ------ | ------------------ |
| Basic | Input Data-object     | This is the location where the system can find the data to be transformed. | Object | Mandatory          |
| Basic | Transformation schema | This is the XML-formatted transformation schema.                           | Text   | Mandatory          |
| Basic | Result Data-Object    | This is the location where the system stores the result.                   | Object | Mandatory          |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://community-test.logicnets.com/release-9/platform-documentation/process-node-parts/lua-transform.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
