Data Transforms

What are they?

Data transforms allow you to manipulate the data in datafunnels.

Where can they be used?

Data transforms are available inside of datafunnel tags. Using them directly inside the datafunnel tag will change the datafunnel. Everywhere that references the datafunnel will get the new transformed data.

Data transforms can also be used in data-source tags. Using your transforms in data-source tags does not change the datafunnel. It only transforms the data where you are currently using it.

What are the different transforms?

The transforms include the following:


add-column, add-row

<ct:add-row exclude="rows:1,3,4;columns:1" output="###,###" function="rsum" add-label="c1:run title"/>

<ct:add-row exclude="rows:1,3,4;columns:1" output="###,###" function="ravg" add-label="c1:run title"/>

<ct:add-column exclude="rows:1;columns:1" function="sum" add-label="r1:sum title"/>

<ct:add-column exclude="rows:1-3" output="###,###" function="avg" add-label="r3:avg title"/>

<ct:add-row exclude="columns:1" function="min" add-label="c1:min title"/>

<ct:add-row exclude="columns:1" function="max" add-label="c1:max title"/>

<ct:add-row exclude="columns:1" function="mid" />

<ct:add-column exclude="rows:1" output="###,###" function="=(c1+c2)/lc3" add-label="r1:function"/>

Notes on add-row and add-column

Allows you to add a row or column to the datafunnel that is some mathematical computation of other rows and columns.

exclude takes any of the rows/columns syntax defined in filters.

output specifies the number format in Java NumberFormat String form for the row or column to be added.

Available Functions


change-values

<ct:change-values>

<ct:format type="numeric" output="0.00" apply-to="columns:1,7-10" exclude="rows:1-2" />

<ct:format type="numeric" output="###,##0.00" apply-to="columns:2" exclude="rows:1-2" />

<ct:format type="numeric" output="0.000000E00" apply-to="rows:3" exclude="columns:1-2" />

<ct:format type="date" input="MM/dd/yyyy hh:mm:ss" output="yyyy-mm-dd" apply-to="columns:4" exclude="rows:1-2" />

<ct:replace input="oldname" output="new name" case-sensitive="true(default)|false" apply-to="columns:5" exclude="rows:1-2"/>

<ct:replace input="oldname1" output="new name1" case-sensitive="true(default)|false" apply-to="rows:5" exclude="columns:1-2"/>

<ct:replace input="oldname2" output="new name2" case-sensitive="true(default)|false" apply-to="columns:5" exclude="rows:1-2"/>

<ct:regular-expression match="old(.*)name" replace="new$1name" case-sensitive="true(default)|false" apply-to="columns:6" exclude="rows:1-2"/>

</ct:change-values>

Notes on change-values


collapse-rows

<ct:collapse-rows exclude="" match="columns:1">

<ct:operation apply-to="columns:2" function="sum" />

<ct:operation apply-to="columns:3" function="avg" />

<ct:operation apply-to="columns:4" function="concat(,)" />

<ct:operation apply-to="columns:4" function="concat(&lt;br/&gt;)" />

</ct:collapse-rows>

Notes on collapse-rows

Available Functions

Note: If the output is going into a table, you may want to use br instead. (Note syntax in example for br.)


column-reorder

<ct:column-reorder order="1,2,1,3,1,4"/>

Notes on column-reorder

Order is the new column order to return the datafunnel in.

Columns can be used multiple times as in the example, where the first column is referenced 3 times.


external-transform plugin

<ct:external-transform plugin="class:com.corda.demo.plugin" parameters="string"/>

Notes on using external-transform plugin

The current state of the datafunnel is passed to the plugin class specified as a two dimension array of strings. The plugin can manipulate the strings however it wants, add or remove and returns a two dimensional array of Strings. Callbacks are provided to the plugin to get values for request.variables, etc.


filter

<ct:filter disable="rows|columns|last-rows|last-columns:1,3-6,12;rows-like|columns-like|rows-not-like|columns-not-like:MatchString" enable="rows|columns|last-rows|last-columns:1,3-6,12; rows-like|columns-like|rows-not-like|columns-not-like:MatchString" reverse-rows="(false)|true|all-but-first" transpose="(false)|true" remove-empty-rows-and-columns="false|(true)"/>

Notes on filter


reverse-rows

<ct:reverse-rows exclude="rows|last-rows:1-2"/>

Notes on reverse-rows

Allows you to use syntax of (rows|last-rows|rows-like|rows-not-like) described in filter above.

If a row is excluded in the middle of a large datafunnel, e.g. 30, then the rows before it will be reversed in a block and the rows after it will be reversed in a block. So rows 1-29 will be reversed in a block and 31 - n will be reversed in a block. It will not be treated as one contiguous block where all but that row are reversed.


sort

<ct:sort exclude="rows|last-rows:1,2">

<ct:alpha-sort direction="(ascending)|descending" case-sensitive="(true)|false" apply-to="columns:1"/>

<ct:numeric-sort direction="(ascending)|descending" case-sensitive="(true)|false" apply-to="columns:1"/>

<ct:list-sort case-sensitive="(true)|false" include-all="(false)|true" zero-fill="columns: 1-4" list="outstanding;exceeds expectations;proficient;needs improvement" apply-to="columns:3"/>

<ct:date-sort format="yyyy-MM-dd hh:mm:ss" direction="(ascending)|descending" apply-to="columns:5"/>

</ct:sort>

Notes on sorting


fill-empty-cells

<ct:fill-empty-cells exclude="string" apply-to="string" fill-with="(previous-row)|specific-value" value="string" />

Notes on fill-empty-cells

Replaces empty cells with specific data or data from the previous row.


from-legacy

<ct:from-legacy last-column="string" add-header-row="(true)|false" />

Notes on from-legacy

Converts data from legacy form from the datafunnel to a group-item-value form.


to-legacy

<ct:to-legacy group="string" item="string" value="string" data-has-header="(true)|false" />

Notes on to-legacy

Converts data to legacy form from the datafunnel.