Advanced Row Formatting - LevelFormat

Release 1.0 - ...

Besides grouping data by a string value in a column, your data can also be grouped by an integer value in a column where this integer value indicates the level of a row, effectively building a tree structure from your data. The rowformat is applied to every row, the levelformat is applied to every group of rows, indicated by the value of the expression in the levelformat groupby attribute. The difference between groupformat and levelformat is that the levelformat understands the hierarchy of the data and combines the child levels into a level before formatting the entire level. Again, multiple levelformats may be specified by using the match and expression attribute. The groupby attribute must be defined at least once on any of the levelformat elements. If it is defined more than once it should always contain exactly the same viper expression.

Example:

Smartsite SXML CopyCode image Copy Code
<se:sqlquery>
 <se:parameters>

<se:parameter name="sql">
   select 1 as nr, 1 as level, 'Root' as title
   union select 2, 2, 'Product'
   union select 3, 3, 'Smartsite'
   union select 4, 3, 'SmartIets'
   union select 5, 3, 'SmartNL'
   union select 6, 2, 'Support'
   union select 7, 3, 'Support 4.5'
   union select 8, 4, 'Installation'
   union select 9, 4, 'Configuration'
   union select 10, 4, 'Development'
   union select 11, 5, 'Components'
   union select 12, 5, 'COM SDK'
   union select 13, 5, 'Device driver kit'
   union select 14, 3, 'Support 5'
  </se:parameter>

<se:parameter name="format">

  <se:rowformat>
    <li>
     {this.field(nr)} = {this.field(title)} ({this.field(level)})
     {this.childlevelresult()}
    </li>
   </se:rowformat>

  <se:levelformat groupby="this.field(level)">
    <ul style="background-color: #ffa0a0;">
     {this.levelresult()}
    </ul>
   </se:levelformat>

  <se:levelformat match="even">
    <ul style="background-color: #a0a0ff;">
     {this.levelresult()}
    </ul>
   </se:levelformat>

  <se:levelformat match="3">
    <ul style="background-color: #ffffa0;">
     {this.levelresult()}
    </ul>
   </se:levelformat>

  </se:parameter>
 </se:parameters>
</se:sqlquery>