0

LUA Transform

  • updated 2 yrs ago

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 This copies the value from the source data object or value to the target.

Note: This transform-schema element cannot have child transform-schema elements.
source input data-object path.

value input-value.

name target data-object path
lua:table This processes the child transform-schema-elements on the <source> data-object or <value> and places the result in the target <name> location..

Note: If you leave both the source and value empty the system uses the parent data object.
source input data-object path.

value input-value.

name target data-object path
lua:collection This iterates through (the numbered and alphanumeric indexes) all child elements of the <source> and adds the values to a collection called <name>..

If the child element is a LUA structure the system determines the resulting value by processing all child transform-schema elements first..

Note: If you leave the source empty the system uses teh parent data object.
source input data-object path.

name target data-object path

index if set the index parameter is interpolated using the child element structure. This can be used to generate a collection with alphanumeric indexes
lua:unbase64 The system decodes base64 in the input data object (<source>) or value (<value>) and writes it into the result.

Note: This transform-schema element cannot have child transform-schema elements.
source input data-object path

value input-value

name target data-object path

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 <lua:schemaversion="1.0">

<lua:element name="structurea"source="structurea"/>

<lua:element name="structureb" source="structureb"/>

</lua:schema>
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"/> only the structureb is left

{ structureb = { substructure = { b = "test", a = 1 } } }
1 <lua:element name="structureb2" source="structureb"/> only the structureb is left and it is renamed to structureb2

{ structureb2 = { substructure = { b = "test", a = 1 } } }
1 <lua:table name="structureb2" source="structureb"><lua:element name="substructure" source="substructure"/></lua:table> only the structureb is left and it is renamed to structureb2

{ structureb2 = { substructure = { b = "test", a = 1 } } }
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
Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 2 yrs agoLast active
  • 17Views
  • 2 Following

Home