Table Transformers
Vividus provides a set of pre-registered table transformers. Also Vividus plugins may register own table transformers (they are documented in the corresponding plugins sections). It’s allowed to define a chain of transformers, in this case the transformers are applied sequentially from top to bottom.
FROM_LANDSCAPE
FROM_LANDSCAPE
transformer is designed to transform the table from a landscape form.
{transformer=FROM_LANDSCAPE}
|header 1|value 11| ... | value m1|
...
|header n|value 1n| .... |value mn|
FORMATTING
FORMATTING
transformer formats the table according to the max width of each column. Also this transformer removes the commented lines.
{transformer=FORMATTING}
|key|
|value|
|-- |value|
|longValue|
REPLACING
REPLACING
transformer replaces all substrings inside table values with replacement according to the given parameters.
Parameter | Description |
---|---|
|
the sequence of chars to be replaced in the table cells |
|
the replacing sequence of chars |
{transformer=REPLACING, replacing=k, replacement=l}
|key |
|vakue|
SORTING
SORTING
transformer is designed to sort the table rows by the values in
the columns.
Parameter | Description |
---|---|
|
column names ordered according to the priority of applying sorting (the column names are joined using |
{transformer=SORTING, byColumns=key|key1}
|key |key1 |
|value3|value4|
|value1|value2|
ITERATING
ITERATING
transformer generates simple one-column table with header iterator
and numbers as values: 0, 1, 2… .
Parameter | Description |
---|---|
|
threshold value, so values are generated from 0 to ( |
{transformer=ITERATING, limit=5}
FILTERING
FILTERING
transformer filters the table using the specified parameters.
Parameter | Description |
---|---|
|
the maximum number of columns to keep in the resulting table |
|
the maximum number of rows to keep in the resulting table |
|
the names of the columns to keep in the resulting table |
|
the indexes of the rows to keep in the resulting table |
byMaxColumns and byColumnNames are competing properties and only one can be specified at the same time. The same restriction is applied to the properties byMaxRows and byRowIndexes .
|
{transformer=FILTERING, byColumnNames=key1;key3, byMaxRows=1}
|key1 |key2 |key3 |
|value1|value2|value3|
|value4|value5|value6|
{transformer=FILTERING, byMaxColumns=2, byRowIndexes=0;2}
|key1 |key2 |key3 |
|value1|value2|value3|
|value4|value5|value6|
|value7|value8|value9|
MERGING
MERGING
transformer merges several tables into one.
Parameter | Description |
---|---|
|
rows or columns |
|
paths to examples tables or transformers to merge |
|
value to fill new cells while merging tables with different number of rows (in |
|
{transformer=MERGING, mergeMode=rows, tables=story/tables/test1.table;story/tables/test2.table}
{transformer=MERGING, mergeMode=columns, tables=story/tables/test1.table;story/tables/test2.table;story/tables/test3.table}
{transformer=MERGING, mergeMode=columns, fillerValue=null, tables=\{transformer=FROM_EXCEL\, path=TestTemplate.xlsx\, sheet=Data\, addresses=A2\;A3\, column=test1\};\{transformer=FROM_EXCEL\, path=TestTemplate.xlsx\, sheet=Data\, range=B2:B4\, column=test2\}}
{
transformer=MERGING,
mergeMode=rows,
fillerValue=null,
tables=
\{
transformer=MERGING\,
mergeMode=columns\,
tables=
\\{
transformer=FROM_EXCEL\\,
path=TestTemplate.xlsx\\,
sheet=Data\\,
addresses=E6\\,
column=text1
\\}
\;
\\{
transformer=FROM_EXCEL\\,
path=TestTemplate.xlsx\\,
sheet=Data\\,
addresses=E7\\,
column=text2
\\}
\}
;
\{
transformer=FROM_EXCEL\,
path=TestTemplate.xlsx\,
sheet=Data\,
addresses=E8\,
column=text1
\}
}
{transformer=MERGING, mergeMode=columns, tables=/data/some-table.table}
|column1|
|value1 |
JOINING
JOINING
transformer joins values from rows/columns of the table.
Parameter | Description |
---|---|
|
rows or columns |
|
[columns mode only] name of the new column with joined values |
|
[columns mode only] colon-separated list of the columns to join |
JOINING transformer should be the last while joining columns/rows of the table which created using another transformer.
|
Scenario: Verify JOINING transformer in default columns mode
Then `<joinedColumn>` is equal to `A B`
Examples:
{transformer=JOINING, joinMode=columns, joinedColumn=joinedColumn}
|column1|column2|
|A |B |
Scenario: Verify JOINING transformer in configured columns mode
Then `<joinedColumn>` is equal to `B D`
Examples:
{transformer=JOINING, joinMode=columns, joinedColumn=joinedColumn, columnsToJoin=column2;column4}
|column1|column2|column3|column4|
|A |B |C |D |
Scenario: Verify JOINING transformer in default rows mode
Then `<column1>` is equal to `A B`
Then `<column2>` is equal to `C D`
Examples:
{transformer=JOINING, joinMode=rows}
|column1|column2|
|A |C |
|B |D |
{transformer=MERGING, mergeMode=columns, tables=
\{transformer=FROM_EXCEL\, path=/TestTemplate.xlsx\, sheet=Mapping\, range=A4:A5\, column=header1\, joinValues=true\};
\{transformer=FROM_EXCEL\, path=/TestTemplate.xlsx\, sheet=Mapping\, range=B4:B5\, column=header2\, joinValues=true\}
}
{transformer=JOINING, joinMode=columns, joinedColumn=header}
{transformer=JOINING, joinMode=columns, joinedColumn=header}
/test1.table