Buffer GetAll Example

This example adds four different key-value pairs to the buffer, removes one key and then uses a standard format macro to display the contents of the datatable returned from buffer.getall().

Smartsite SXML CopyCode image Copy Code
<se:region>
{buffer.set(buf1,"buffer 1")}
{buffer.set(buf2,"buffer 2")}
{buffer.set(buf3,"buffer 3")}
{buffer.set(buf4,"buffer 4")}
{buffer.remove(buf4)}

<se:format inputdata="{buffer.getall(region)}">
    <se:rowformat>
        <se:colformat><td>{this.field()}</td></se:colformat>
        <se:rowresult>{char.tab()}<tr>{this.rowresult()}</tr>{char.crlf()}</se:rowresult>
    </se:rowformat>

    <se:captionformat match="first">
        <se:colformat><th>{this.colname()}</th></se:colformat>
        <se:rowresult>{char.tab()}<tr>{this.rowresult()}</tr>{char.crlf()}</se:rowresult>
    </se:captionformat>

    <se:resultformat><table>{char.crlf()}{this.result()}</table></se:resultformat>
</se:format>

</se:region>
Example Result CopyCode image Copy Code
<table>
    <tr><th>Key</th><th>Value</th></tr>
    <tr><td>buf1</td><td>buffer 1</td></tr>
    <tr><td>buf2</td><td>buffer 2</td></tr>
    <tr><td>buf3</td><td>buffer 3</td></tr>
</table>