This Length Example

This example shows the usage of this.length() and this.rownumber() within an se:placeholder macro.

Smartsite SXML CopyCode image Copy Code
<se:placeholder id="test" whitespace="remove">
    <se:parameters>
        <se:parameter name="fieldnames">key,value</se:parameter>        
        <se:parameter name="rowformat">
            <tr><td>{this.field(value)} ({this.rownumber()}/{this.length()})</td></tr>
        </se:parameter>
        <se:parameter name="resultformat">
            <table>{this.result()}</table>
        </se:parameter>
        <se:parameter name="rowdelimiter">{char.crlf()}</se:parameter>
        <se:parameter name="sortcolumn">key</se:parameter>        
    </se:parameters>
</se:placeholder>

{page.test.add(2, 'Second result')}
{page.test.add(5, 'Fith result')}
{page.test.add(1, 'First result')}
{page.test.add(3, 'Third result')}
{page.test.add(4, 'Fourth result')}
Example Result CopyCode image Copy Code
<table><tr><td>First result(1/5)</td></tr>
<tr><td>Second result(2/5)</td></tr>
<tr><td>Third result(3/5)</td></tr>
<tr><td>Fourth result(4/5)</td></tr>
<tr><td>Fith result(5/5)</td></tr></table>