Advanced Row Formatting - CaptionFormat

Release 1.0 - ...

When using column formatting, you may want to give the reader a hint on what data it sees in a given column. CaptionFormat can be used to output the names of the column it prints. You may define multiple captionformats with different match or expression attributes, just like you do with rowformats.

Example 1:

Smartsite SXML CopyCode image Copy Code
<se:sqlquery sql="select top 10 Nr, Name from FileTypes order by Nr">
    <se:parameters>
                                
        <se:parameter name="format">
                                
            <!--// Print a caption row every 5 lines -->
            <se:captionformat expression="this.rownumber() % 5 == 1">
                <se:colformat trim="right">
                    <th>{this.colname()}</th>
                </se:colformat>
                <se:rowresult trim="right">
                <tr>
                        {this.rowresult()}
                </tr>
                </se:rowresult>
            </se:captionformat>
 
            <!--// Format each row with this rowformat -->
            <se:rowformat>
                <se:colformat trim="right">
                    <td>{this.field()}</td>
                </se:colformat>
                <se:rowresult trim="right">
                <tr>
                        {this.rowresult()}
                </tr>
                </se:rowresult>
            </se:rowformat>
      
        </se:parameter>
    
        <se:parameter name="resultformat">
            <table border="1">
                {this.result()}
            </table>
        </se:parameter>
    </se:parameters>
  
</se:sqlquery>

You can of course also use captionformats with no colformats.

Example 2:

Smartsite SXML CopyCode image Copy Code
<se:sqlquery sql="select top 10 Name from FileTypes order by Nr">
    <se:parameters>
        <se:parameter name="format">
    
            <!--// Print a caption row every 5 lines -->
            <se:captionformat expression="this.rownumber() % 5 == 1">
                <h1>File types</h1>
            </se:captionformat>
        
            <!--// Format each row with this rowformat -->
            <se:rowformat>
                {this.field(1)}<br />
            </se:rowformat>
      
        </se:parameter>
 
    </se:parameters>
</se:sqlquery>