Back

Check if key/value field has content

Description

This should be thought of as the equivalent of $UtilMethods.isSet. Unfortunately, that method always returns true for key/value pairs. So we need to look at the size of the entry set. This is especially useful if you have code or HTML that you don't want executed if there are no key/value pairs in a given piece of content.

Code

## Variables assumed:
## $con is content already pulled
## $con.keysAndValues is the key/value pair

#if($con.keysAndValues.map.entrySet().size() > 0)
 <table>
     #foreach($c in $con.keysAndValues.map.entrySet())
      <tr>
          <td>$c.key</td>
          <td>$c.value</td>
      </tr>
     #end
 </table>
#end