Has anyone writtten a DB Publishing template that will output a row entry per item selected in a checkbox tree with a column for content ID and a column for Checkbox reference. (i.e. one to many, the way the data is stored by Rhythmyx)
Not sure if I should be performing some iteration in a binding as I would in Velocity after using the getValues() function?
As a matter of fact, we had a requirement for something like this just last week.
What you have to do is use the foreach function in JEXL. Although the documentation won’t tell you this, the resulting binding $child.COLUMNNAME should be a LIST of values. You can create an empty list with
$valueList = $user.psoListTools.asList("x", 0);
(The value x isn’t used, it’s a zero length list), and then add each value inside the foreach loop with:
after the loop completes, just assign the list to $child.COLUMNNAME (or whatever the column name is).
I hope this helps
We’ve just assigned the column the value:
$child.CONTENTID = $sys.item.getProperty("rx:sys_contentid").String
$child.CHECKBOXTREE_VALUE = $sys.item.getProperty("rx:fieldname").getValues()
Interesting solution however how does one replicate the child table as stored in Rhythmyx i.e. a selected value per row?
As the getValues() function returns a list you get a row for each value in the list eg
contentid = 1234
list = (1, 2, 3, 4)
child table rows: