Displaying multi-valued properties

Hi,

How would one go about displaying values of checkbox group or multi-selection dropdown?

Thanks…

To elaborate:
One of our content types has a checkbox group field (source is Keyword). How would I show multiple values in a template?
Thanks.

The key to this is to use $sys.item.getProperty(“rx:myfield”)

This returns a javax.jcr.Property object. It’s possible to get the values from a multi-value field with Property.getValues() which returns an array of javax.jcr.Value objects. You can use Value.getString() to retrieve each value.

Of course, these Value strings are the “codes” not the display labels (which I’m sure is what you really want).

You have to use $rx.keyword.getLabel() to translate each value into the label as you want it displayed.

Sorry I don’t have a worked example of this, but it should not be too hard.

Dave

Thank you Dave

Giving back:

#set($myList = $user.psoListTools.asList($sys.item.getProperty(“rx:myfield”).getValues()))

#foreach($a in $myList)
#set($lbl = $rx.keyword.getLabel(‘myKwd’,$a.getString()))
$label$delimiter
#end

(+ some code to correctly delimit displayed list)