Chart grouped by customfield

Dear RT users/developpers :wink:

Iā€™m trying to draw charts grouped by customfield (using the
functionnality at the bottom of a search result) and on a customfiled of
type ā€œselect unique valueā€. But the result graph is empty :frowning:
It works with other group by like status, queue, ā€¦

If someone has some hints on solving this ā€¦ thank you!

Dear RT users/developpers :wink:

Iā€™m trying to draw charts grouped by customfield (using the
functionnality at the bottom of a search result) and on a customfiled of
type ā€œselect unique valueā€. But the result graph is empty :frowning:
It works with other group by like status, queue, ā€¦

If someone has some hints on solving this ā€¦ thank you!

I forgot ā€¦ Iā€™m using the latest RT 3.6.5 on RH CentOS 5 with Oracle XE
10.

what shows up in your error logs?------- Original message -------
From: Emmanuel Lacour elacour@easter-eggs.com
Sent: 10-10-'07, 3:43

Dear RT users/developpers :wink:

Iā€™m trying to draw charts grouped by customfield (using the
functionnality at the bottom of a search result) and on a customfiled of
type ā€œselect unique valueā€. But the result graph is empty :frowning:
It works with other group by like status, queue, ā€¦

If someone has some hints on solving this ā€¦ thank you!


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RTā€™s hidden secrets with RT Essentials from Oā€™Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Hi, dear RT primary Author :wink:

what shows up in your error logs?

Thatā€™s the good question ā€¦ sorry I forgot to look here :frowning:

There is DBD prepare errors:

RT: RT::Handle=HASH(0x8134df1c) couldnā€™t prepare the query 'SELECT COUNT(main.id) AS id, ObjectCustomFieldValues_1.Content AS col1 FROM ( SELECT DISTINCT main.id FROM Tickets main LEFT JOIN ObjectCustomFieldValues ObjectCustomFieldValues_1 ON ( ObjectCustomFieldValues_1.CustomField = ā€˜1ā€™ ) AND ( ObjectCustomFieldValues_1.ObjectType = ā€˜RT::Ticketā€™ ) AND ( ObjectCustomFieldValues_1.Disabled = ā€˜0ā€™ ) AND ( ObjectCustomFieldValues_1.ObjectId = main.id ) WHERE (main.Status != ā€˜deletedā€™) AND (main.Status != ā€˜resolvedā€™) AND (main.Type = ā€˜ticketā€™) AND (main.EffectiveId = main.id) ) distinctquery, Tickets main WHERE (main.id = distinctquery.id) GROUP BY ObjectCustomFieldValues_1.Content

'ORA-00904: ā€œOBJECTCUSTOMFIELDVALUES_1ā€.ā€œCONTENTā€: invalid identifier
(DBD ERROR: error possibly near <*> indicator at char 596 in 'SELECT COUNT(main.id) AS id, ObjectCustomFieldValues_1.Content AS col1 FROM ( SELECT DISTINCT main.id FROM Tickets main LEFT JOIN ObjectCustomFieldValues ObjectCustomFieldValues_1

Here is more information on my setup:

DBIx-SearchBuilder-1.49
DBD-Oracle-1.19
Oracle Xe 10.2.0.1
Perl 5.8.8

Thanks for your help :slight_smile:

Hi, dear RT primary Author :wink:

what shows up in your error logs?

Thatā€™s the good question ā€¦ sorry I forgot to look here :frowning:

I suspect that it has to do with ā€œthis was tested on mysql and pgā€

Any oracle folks see what weā€™re doing wrong with that SQL?

PGP.sig (186 Bytes)

I suspect that it has to do with ā€œthis was tested on mysql and pgā€

if only I had power to choose the database Engine ā€¦ :wink:

distinctquery, Tickets main WHERE (main.id = distinctquery.id)

Shouldnā€™t be present a comma between Tickets and main?

Sorry main was an alias for Tickets tableā€¦

If I use the same query on mysql 9without the commaā€¦) I get:

ERROR 1054 (42S22): Unknown column ā€˜ObjectCustomFieldValues_1.Contentā€™ in ā€˜field listā€™

And the oracle error 904 is ā€œinvalid column nameā€ too

Sorry main was an alias for Tickets tableā€¦

If I use the same query on mysql 9without the commaā€¦) I get:

ERROR 1054 (42S22): Unknown column ā€˜ObjectCustomFieldValues_1.Contentā€™ in ā€˜field listā€™

And the oracle error 904 is ā€œinvalid column nameā€ too

Here is the SQL for the same Graph on a MySQL RT, gived by StatementLog (graph by CustomFields works with MySQL):

SELECT DISTINCT COUNT(main.id) AS id, ObjectCustomFieldValues_1.Content AS col1 FROM (Tickets main LEFT JOIN ObjectCustomFieldValues ObjectCustomFieldValues_1 ON ((ObjectCustomFieldValues_1.CustomField = ā€˜1ā€™)) AND ( (ObjectCustomFieldValues_1.ObjectType = ā€˜RT::Ticketā€™)) AND ( (ObjectCustomFieldValues_1.Disabled = ā€˜0ā€™)) AND ( ObjectCustomFieldValues_1.ObjectId = main.id)) WHERE ((main.EffectiveId = main.id)) AND ((main.Status != ā€˜deletedā€™)) AND ((main.Type = ā€˜ticketā€™)) AND ((main.Created < ā€˜2007-10-31 23:00:00ā€™) AND (main.Created > ā€˜2007-09-29 22:00:00ā€™)) GROUP BY ObjectCustomFieldValues_1.Content ;

and the one for the Oracle RT:

SELECT COUNT(main.id) AS id, ObjectCustomFieldValues_1.Content AS col1 FROM ( SELECT DISTINCT main.id FROM Tickets main LEFT JOIN ObjectCustomFieldValues ObjectCustomFieldValues_1 ON ( ObjectCustomFieldValues_1.CustomField = ā€˜1ā€™ ) AND ( ObjectCustomFieldValues_1.ObjectType = ā€˜RT::Ticketā€™ ) AND ( ObjectCustomFieldValues_1.Disabled = ā€˜0ā€™ ) AND ( ObjectCustomFieldValues_1.ObjectId = main.id ) WHERE (main.Status != ā€˜deletedā€™) AND (main.Status != ā€˜resolvedā€™) AND (main.Type = ā€˜ticketā€™) AND (main.EffectiveId = main.id) ) distinctquery, Tickets main WHERE (main.id = distinctquery.id) GROUP BY ObjectCustomFieldValues_1.Content
;

Jesse Vincent wrote:

I suspect that it has to do with ā€œthis was tested on mysql and pgā€
Any oracle folks see what weā€™re doing wrong with that SQL?

There is DBD prepare errors:

RT: RT::Handle=HASH(0x8134df1c) couldnā€™t prepare the query 'SELECT
COUNT(main.id) AS id, ObjectCustomFieldValues_1.Content AS col1 FROM (
SELECT DISTINCT main.id FROM Tickets main LEFT JOIN
ObjectCustomFieldValues ObjectCustomFieldValues_1 ON (
ObjectCustomFieldValues_1.CustomField = ā€˜1ā€™ ) AND (
ObjectCustomFieldValues_1.ObjectType = ā€˜RT::Ticketā€™ ) AND (
ObjectCustomFieldValues_1.Disabled = ā€˜0ā€™ ) AND (
ObjectCustomFieldValues_1.ObjectId = main.id ) WHERE (main.Status !=
ā€˜deletedā€™) AND (main.Status != ā€˜resolvedā€™) AND (main.Type = ā€˜ticketā€™)
AND (main.EffectiveId = main.id) ) distinctquery, Tickets main WHERE
(main.id = distinctquery.id) GROUP BY ObjectCustomFieldValues_1.Content

Problem is that in the group by there is a alias which is defined in the
subquery.
ObjectCustomFieldValues_1 is only known in the innermost query not the
outer one.
There is another problem aswell since modifing the query gives me
another unidentified error.
Iā€™ll see if my DBA can have a look at it.

Joop

Emmanuel Lacour wrote:> On Wed, Oct 10, 2007 at 05:46:31PM +0200, Gianluca Cecchi wrote:

Sorry main was an alias for Tickets tableā€¦

If I use the same query on mysql 9without the commaā€¦) I get:

ERROR 1054 (42S22): Unknown column ā€˜ObjectCustomFieldValues_1.Contentā€™ in ā€˜field listā€™

And the oracle error 904 is ā€œinvalid column nameā€ too

Here is the SQL for the same Graph on a MySQL RT, gived by StatementLog (graph by CustomFields works with MySQL):

SELECT DISTINCT COUNT(main.id) AS id, ObjectCustomFieldValues_1.Content AS col1 FROM (Tickets main LEFT JOIN ObjectCustomFieldValues ObjectCustomFieldValues_1 ON ((ObjectCustomFieldValues_1.CustomField = ā€˜1ā€™)) AND ( (ObjectCustomFieldValues_1.ObjectType = ā€˜RT::Ticketā€™)) AND ( (ObjectCustomFieldValues_1.Disabled = ā€˜0ā€™)) AND ( ObjectCustomFieldValues_1.ObjectId = main.id)) WHERE ((main.EffectiveId = main.id)) AND ((main.Status != ā€˜deletedā€™)) AND ((main.Type = ā€˜ticketā€™)) AND ((main.Created < ā€˜2007-10-31 23:00:00ā€™) AND (main.Created > ā€˜2007-09-29 22:00:00ā€™)) GROUP BY ObjectCustomFieldValues_1.Content ;
Weird, this one works without modification on Oracle XE.

I suspect that it has to do with ā€œthis was tested on mysql and pgā€

if only I had power to choose the database Engine ā€¦ :wink:

It should work on everything. The fact that it doesnā€™t is definitely
a bug.

PGP.sig (186 Bytes)

To all,

We are on Oracle 10g and we have the same problems with custom fields 

when it comes to charts from query results or sorting by them as well.

Kenn
LBNLOn 10/10/2007 1:25 PM, Jesse Vincent wrote:

On Oct 10, 2007, at 10:03 AM, Emmanuel Lacour wrote:

On Wed, Oct 10, 2007 at 09:42:21AM -0400, Jesse Vincent wrote:

I suspect that it has to do with ā€œthis was tested on mysql and pgā€

if only I had power to choose the database Engine ā€¦ :wink:

It should work on everything. The fact that it doesnā€™t is definitely a bug.



The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RTā€™s hidden secrets with RT Essentials from Oā€™Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Itā€™s an experimental and untested patch that may help.

When a query has a ā€œgroup byā€ part we really donā€™t want to make it
distinct as I donā€™t see any way it can have not unique entries in the
result set.

Patch is for DBIx::SearchBuilder, to try it use the following steps:

  1. untar DBIx::SBā€™s tarball
  2. apply patch
  3. install it
  4. stop/start server
  5. test, collect errors if any
  6. reinstall clean DBIx::SB
  7. stop/start serverOn 10/10/07, Joop van de Wege JoopvandeWege@mococo.nl wrote:

Emmanuel Lacour wrote:

On Wed, Oct 10, 2007 at 05:46:31PM +0200, Gianluca Cecchi wrote:

Sorry main was an alias for Tickets tableā€¦

If I use the same query on mysql 9without the commaā€¦) I get:

ERROR 1054 (42S22): Unknown column ā€˜ObjectCustomFieldValues_1.Contentā€™ in ā€˜field listā€™

And the oracle error 904 is ā€œinvalid column nameā€ too

Here is the SQL for the same Graph on a MySQL RT, gived by StatementLog (graph by CustomFields works with MySQL):

SELECT DISTINCT COUNT(main.id) AS id, ObjectCustomFieldValues_1.Content AS col1 FROM (Tickets main LEFT JOIN ObjectCustomFieldValues ObjectCustomFieldValues_1 ON ((ObjectCustomFieldValues_1.CustomField = ā€˜1ā€™)) AND ( (ObjectCustomFieldValues_1.ObjectType = ā€˜RT::Ticketā€™)) AND ( (ObjectCustomFieldValues_1.Disabled = ā€˜0ā€™)) AND ( ObjectCustomFieldValues_1.ObjectId = main.id)) WHERE ((main.EffectiveId = main.id)) AND ((main.Status != ā€˜deletedā€™)) AND ((main.Type = ā€˜ticketā€™)) AND ((main.Created < ā€˜2007-10-31 23:00:00ā€™) AND (main.Created > ā€˜2007-09-29 22:00:00ā€™)) GROUP BY ObjectCustomFieldValues_1.Content ;
Weird, this one works without modification on Oracle XE.


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RTā€™s hidden secrets with RT Essentials from Oā€™Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Best regards, Ruslan.

dbix-sb-oracle.patch (609 Bytes)

Itā€™s an experimental and untested patch that may help.

It helps, and works here :))

Thanks you very much!

Itā€™s an experimental and untested patch that may help.

It helps, and works here :))

Thanks you very much!

Thatā€™s cool, let it spin for several daysā€¦ And may be during next
week weā€™ll release new version of SB.

Joop, any comments?

Best regards, Ruslan.

Ruslan Zakirov wrote:> On 10/11/07, Emmanuel Lacour elacour@easter-eggs.com wrote:

On Thu, Oct 11, 2007 at 06:44:04AM +0400, Ruslan Zakirov wrote:

Itā€™s an experimental and untested patch that may help.

It helps, and works here :))

Thanks you very much!

Thatā€™s cool, let it spin for several daysā€¦ And may be during next
week weā€™ll release new version of SB.

Joop, any comments?
Havenā€™t had time to try the patch on our test instance and donā€™t know
when I will. Might be somewhere next week.
The patch looks clean to me and if that statement that worked is the
result of this patch then it looks certainly OK.

Joop

The patch is in DBIx::SearchBuilder 1.50 which on its way to the CPAN.
It will be available from mirrors soon.On Oct 11, 2007 11:08 PM, Joop van de Wege JoopvandeWege@mococo.nl wrote:

Ruslan Zakirov wrote:

On 10/11/07, Emmanuel Lacour elacour@easter-eggs.com wrote:

On Thu, Oct 11, 2007 at 06:44:04AM +0400, Ruslan Zakirov wrote:

Itā€™s an experimental and untested patch that may help.

It helps, and works here :))

Thanks you very much!

Thatā€™s cool, let it spin for several daysā€¦ And may be during next
week weā€™ll release new version of SB.

Joop, any comments?
Havenā€™t had time to try the patch on our test instance and donā€™t know
when I will. Might be somewhere next week.
The patch looks clean to me and if that statement that worked is the
result of this patch then it looks certainly OK.

Joop


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RTā€™s hidden secrets with RT Essentials from Oā€™Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Best regards, Ruslan.

The patch is in DBIx::SearchBuilder 1.50 which on its way to the CPAN.
It will be available from mirrors soon.

Great, no problem here with this patch.

Emmanuel Lacour ------------------------------------ Easter-eggs
44-46 rue de lā€™Ouest - 75014 Paris - France - MĆÆĀæĀ½tro GaitĆÆĀæĀ½
Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 41 35 00 76
mailto:elacour@easter-eggs.com - http://www.easter-eggs.com