Project

General

Profile

Actions

Feature #22297

open

Group by custom field of type text

Added by syed hussain over 8 years ago. Updated about 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Custom fields
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

We are unable to create a custom field of type text. Group by work for custom fields of type integer etc but "text" format ones cannot be gorup by.

Actions #1

Updated by Toshi MARUYAMA over 8 years ago

  • Tracker changed from Defect to Feature
  • Subject changed from Unable to group by custom field of type text to Group by custom field of type text
Actions #2

Updated by Bruno Medeiros almost 7 years ago

This seems to work already, at least in Planio hosted version. Maybe they contribute with a patch if that's the case.

What I see is that we cannot group by a field that is not for "all projects". Does it make sense?

Actions #3

Updated by Felix Schäfer almost 7 years ago

Bruno Medeiros wrote:

This seems to work already, at least in Planio hosted version. Maybe they contribute with a patch if that's the case.

This is something that we would contribute if we were to work on it, but I am not aware this is possible on Planio. Could you double-check that you can group an issue list by a custom field of type "text"?

What I see is that we cannot group by a field that is not for "all projects". Does it make sense?

I am able to group by a custom field that is defined on only one project in that project's issue list. Do you maybe mean that you can only use custom fields defined as "for all projects" to group by on the global issue list?

Actions #4

Updated by Hong Cheu Lim over 6 years ago

This indeed could be achieved by patching, see patch below.
This seem to work for me with minor limitation,i.e. string after n in the example below(255) char will be truncated

diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb
index fade7c2..ad9041c 100644
--- a/lib/redmine/field_format.rb
+++ b/lib/redmine/field_format.rb
@@ -387,6 +387,10 @@ module Redmine
           value.to_s
         end
       end
+
+      def group_statement(custom_field)
+        "CAST(cf_#{custom_field.id}.value AS char(255))" 
+      end
     end

     class TextFormat < Unbounded

Environment:
  Redmine version                3.4.2.stable
  Ruby version                   2.4.2-p198 (2017-09-14) [x86_64-linux]
  Rails version                  4.2.8
  Environment                    development
  Database adapter               Mysql2 (mariadb)
Actions #5

Updated by Eugene B about 2 years ago

Anyone who can please post update for patch for 5.0.3 version.
patch above is now causing "thin" and "thin2" servers to stop

we used it alot.

Actions

Also available in: Atom PDF