Views Sorting with Math Field doesn´t work

Created on 12 August 2022, over 2 years ago
Updated 25 July 2023, over 1 year ago

Problem/Motivation

i have a view with pictures where i use 4 fivestar ratings to vote on the pictures. i add all 4 results to a summary with the simple math field in the view. this works great and gives me the correct value below the picture in the view. depending on these summary i want to sort the view-list from the picture with the most points to the lowest and this doesn´t work. the sorting is not like 1, 2, 3,... it is 2, 1, 3 (desc) and 3, 1, 2 (asc)

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Postponed: needs info

Version

3.0

Component

Code

Created by

🇦🇹Austria gr4phic3r

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States erutan

    I've come across the same issue in a standard table and a table using aggregation. I have a very simple math field "outstanding" (amount - paid) that it'd be nice to sort by since most of them are 0. No pagination. I get the following error on Drupal 9.5.10 and 3.0.1 of this field. I'm using storage (contrib) entity types but I'm not sure why that would impact things.

    The website encountered an unexpected error. Please try again later.
    
    Drupal\Core\Database\DatabaseExceptionWrapper: Exception in Purchase Order - Invoices[purchase_order_invoices]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_views_simple_math_field' in 'order clause': SELECT "storage_field_data"."id" AS "id" FROM "storage_field_data" "storage_field_data" WHERE ("storage_field_data"."status" = :db_condition_placeholder_0) AND ("storage_field_data"."type" IN (:db_condition_placeholder_1)) ORDER BY "field_views_simple_math_field" ASC; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => wildlife_purchase_order ) in main() (line 19 of index.php).
Production build 0.71.5 2024