[rt-devel] Trying to sort the values of a CF

Joop jvdwege at xs4all.nl
Fri Jul 4 10:20:19 EDT 2014


Hi All,

I would like to sort the content of a CF of type 'enter multiple values'.
I had a look at the element displaying this but can't make this work.
Probably my very weak perl skills are the problem.
The following is from that element:

% $m->callback( CallbackName => 'BeforeCustomFields', Object => $Object,
%               Grouping => $Grouping, ARGSRef => \%ARGS, CustomFields
=> $CustomFields, Table => $Table );
% if ($Table) {
<table>
% }
% while ( my $CustomField = $CustomFields->Next ) {
% my $Values = $Object->CustomFieldValues( $CustomField->Id );
% my $count = $Values->Count;
  <tr id="CF-<%$CustomField->id%>-ShowRow">
    <td class="label"><% $CustomField->Name %>:</td>
    <td class="value">
% unless ( $count ) {
<i><&|/l&>(no value)</&></i>
% } elsif ( $count == 1 ) {
%   $print_value->( $CustomField, $Values->First );
% } else {
<ul>
% while ( my $Value = $Values->Next ) {
<li>
% $print_value->( $CustomField, $Value );
</li>
% }
</ul>
% }
    </td>
% $m->callback( CallbackName => 'AfterCustomFieldValue', CustomField =>
$CustomField,
%               Object => $Object, Grouping => $Grouping, Table => $Table );
  </tr>
% }
% if ($Table) {
</table>
% }
% $m->callback( CallbackName => 'AfterCustomFields', Object => $Object,
%               Grouping => $Grouping, ARGSRef => \%ARGS, Table =>
$Table );


The while $value = $values->next''prints one line at at time the content
of the CF. I would like to sort this content prior to displaying it.

Any help is appreciated,

Joop


More information about the rt-devel mailing list