craft-preparse-field icon indicating copy to clipboard operation
craft-preparse-field copied to clipboard

orderBy on Preparse field not returning expected results

Open kragit opened this issue 7 months ago • 2 comments

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?

kragit avatar Jul 19 '25 01:07 kragit