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

Kevin Falcone falcone at bestpractical.com
Thu Jul 10 21:29:14 EDT 2014


On Fri, Jul 04, 2014 at 04:20:19PM +0200, Joop wrote:
> 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.

How do you want to sort them, can you do a database sort?

> % my $Values = $Object->CustomFieldValues( $CustomField->Id );

You can say $Values->OrderBy(FIELD => 'Content', ORDER => 'ASC');
https://metacpan.org/pod/DBIx::SearchBuilder#OrderBy-PARAMHASH

If you need to do it in perl, you need to rewrite that loop using
ItemsArrayRef and passing through perl's sort().

Alternately, you could modify the code that stores, since it stores an
OrderBy field which is what RT normally uses to display.

Keep in mind that changing here will not change the editing view while
ensuring SortOrder is correct will work there.

-kevin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 235 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-devel/attachments/20140710/badbdcaf/attachment.pgp>


More information about the rt-devel mailing list