Hi Richard, On Fri, 25 Sep 2015 13:40:39 -0500 Richard Reina <gatorreina@gmail.com> wrote:
I display a hash reference in a template. It works well but is there a way I can sort it by SNAME instead of ID?
<ul class="list-group fancy-list-items"> <!-- <ul class="list-group checked-list-box"> --> <table style="width:100%"> <% FOREACH ID IN Pats.keys.sort %> <tr class="list-group-item"> <td width="70"><% Pats.$ID.SNAME %></td> <td width="75"><% Pats.$ID.ANAME %></td> <td width="35"><% Pats.$ID.SSN %></td> <td width="35"><% Pats.$ID.YR %></td> <td width="250"><% Pats.$ID.CHNAME %></td> <td width="550"><% Pats.$ID.DESCRIP %></td> <% END %> </tr>
1. You should put the "<% END %>" after the "</tr>" or otherwise the HTML won't be well-formed (even though it may still display correctly). 2. Please consider passing the Pats hash to the view/template as an already sorted array-reference (or as a different parameter to it that way) because there's a limit to how much complexity you should put in the template (even assuming it may be possible). Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ http://www.shlomifish.org/humour/bits/Can-I-SCO-Now/ - “Can I SCO Now?” Chuck Norris helps God help those that help themselves. — http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/ Please reply to list if it's a mailing list post - http://shlom.in/reply .