DataTable Transpose Example

This examples transposes a simple datatable.

Smartsite SXML CopyCode image Copy Code
{buffer.set(mytable, datatable.createempty(FirstName, LastName, Phone))}
{datatable.rows.add($mytable, 'John', 'Patel', '555-31415')}
{datatable.rows.add($mytable, 'Karin', 'Whitehouse', '555-90210')}

The original datatable:
{datatable.simpleformat($mytable)}

The transposed datatable:
{datatable.simpleformat(datatable.transpose($mytable))}
Example Result CopyCode image Copy Code
The original datatable:
FirstName=John; LastName=Patel; Phone=555-31415
FirstName=Karin; LastName=Whitehouse; Phone=555-90210

The transposed datatable:
Column1=John; Column2=Karin
Column1=Patel; Column2=Whitehouse
Column1=555-31415; Column2=555-90210
SXML