Use for a solution enabling sorting by a re-written field

Created on 13 February 2024, about 1 year ago
Updated 6 May 2024, 11 months ago

Problem/Motivation

This module is a very neat addition to the View arsenal for sure.
I will certainly be using the built-in features to sort the simple stuff like dates, numbers etc.

Before I dig too deeply though, I thought I would just ask here...

"Might the module help me to SORT the rows of a view based on a re-written field?"

I have an unformatted view that I am am easily able to GROUP by the rendered output of re-written field but I also want to SORT everything by the field before outputting the grouped results.

Thanks all.

πŸ’¬ Support request
Status

Active

Component

Miscellaneous

Created by

πŸ‡¬πŸ‡§United Kingdom SirClickALot Somerset

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @SirClickALot
  • πŸ‡ΊπŸ‡ΈUnited States generalredneck Texas, USA πŸ‡ΊπŸ‡Έ

    I'm really not sure how to achieve this.

  • πŸ‡ΊπŸ‡ΈUnited States generalredneck Texas, USA πŸ‡ΊπŸ‡Έ

    Actually, I guess it depends...

    Like if you can compute the value ahead of time, you can add custom items to the Sort Index. Check out the views_natural_sort.api.php file... I think you might find something in there.

    But if you are looking for something on the fly... like based off a views configuration... that's going to be quite a bit more difficult as the module relies on a prebuilt index to do the computations...

    Example.. removing all the "a, an, the"s from words... or the special stuff we do with numbers to make sure they sort 1, 2, 10... instead of 1, 10, 2. These are all strings stored in the database and linked to the field that they are doing magic on. See the views_natural_sort table in the database.

    But say you wanted to rewrite and sort based off of an argument passed in... that couldn't be easily done without knowing what all the possible arguments could be ahead of time.

  • πŸ‡ΊπŸ‡ΈUnited States generalredneck Texas, USA πŸ‡ΊπŸ‡Έ

    one last thing... have you tried this? Computed Field β†’ . It might give you what you want.

Production build 0.71.5 2024