tag:help-archives.hannonhill.com,2010-02-09:/discussions/velocity-formats/687-for-each-loop-for-single-item-in-data-definition-that-allows-multiplesCascade CMS: Discussion 2013-08-20T01:37:33Ztag:help-archives.hannonhill.com,2010-02-09:Comment/252143502013-02-22T19:35:15Z2013-02-22T19:35:15ZFor each loop for single item in data definition that allows multiples<div><p>Hi Lauren,</p>
<p>The easiest thing to do when you're dealing with multiple
elements is to use the <strong>_XPathTool</strong> to get the
elements, this way you can also use XPath to only get elements that
are not blank.</p>
<p>I made some tweaks to your Format, see the attached file. One
suggestion I have would be to make the categories and
qualifications an unordered list instead of new lines in a
paragraph to make things a bit more usable.</p>
<p>Note: As of 6.10+, we recommend using the
<strong>EscapeTool</strong> to escape the value of elements,
instead of the <strong>SerializerTool</strong> (used more for
WYSIWYG content).</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/252143502013-02-22T19:51:31Z2013-02-22T19:51:31ZFor each loop for single item in data definition that allows multiples<div><p>Ryan,<br>
Thanks for the updated script. I made the items with multiples
unordered lists as you suggested.</p>
<p>Also, thanks for the tip on the EscapeTool instead of the
SerializerTool. I'll put it on my list to rework our existing
scripts as I have time.</p></div>lauren.frasertag:help-archives.hannonhill.com,2010-02-09:Comment/252143502013-02-22T19:59:51Z2013-02-22T19:59:51ZFor each loop for single item in data definition that allows multiples<div><p>Not a problem at all, Lauren. Glad to hear that did the
trick.</p>
<p>For <strong>EscapeTool</strong> vs
<strong>SerializerTool</strong>, generally the rule of thumb is to
use SerializerTool with a WYSIWYG field, otherwise use the
EscapeTool. This also gives you more flexibility since the
EscapeTool has different methods available depending on what you
need to escape.</p>
<p>Have a great day!</p></div>Ryan Griffith