Skip to content

orderBy on Preparse field not returning expected results #104

@kragit

Description

@kragit

I'm not getting the expected sort order when attempting to sort entry elements based on the values of a Preparse field.

  • CraftCMS: 5.8.8
  • Preparse 3.0.0-alpha.2
  • Database: PostgreSQL 16.3
  • Sorting method: 'ASC'

A Craft number field produces the following sorting:
Image

A Preparse field set to "Number (integer)" produces the following sorting:
Image

The last bit of code that's executing is a division, which should be outputting a number:
{{ totalSales.sum|number_format(0, '', '') / element.metafields.profit_share|split("\n")|length }}

Craft had a similar issue somewhat recently, but as evidenced by the built-in number field sorting correctly, that doesn't seem to be the issue.

Is there something I'm missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions