Edgewall Software
Modify

Opened 15 years ago

Last modified 8 months ago

#8130 new defect

Report execution failed using Dynamic variables

Reported by: fermaf@… Owned by:
Priority: normal Milestone: next-stable-1.6.x
Component: report system Version: 0.11.2.1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I have tried to do a custom query, which works propertly if I do not use dynamic variables. Like this:

select sum(cuenta.Reabiertos) as "Casos Re-Abiertos Totales",sum (cuenta.Total) as "Casos Totales",to_char(sum(cuenta.Reabiertos)*100/sum(cuenta.Total),'99.9') as "%"
from
(select count (distinct (tt.id)) as Total,0 as Reabiertos
from ticket tt
where
tt.reporter='soporteoperaciones'and 
to_date('01/02/2009', 'DD/MM/YYYY')<=to_timestamp(tt.time) and 
to_date('01/03/2009', 'DD/MM/YYYY')>= to_timestamp(tt.time) 
union all
select 0 as Total,count (distinct (tc.ticket)) as Reabiertos
from ticket_change tc
where
tc.ticket in (select  t.id as ID
from ticket_change tc2,ticket t
where
t.id=tc2.ticket and
t.reporter='soporteoperaciones'and 
to_date('01/02/2009', 'DD/MM/YYYY')<=to_timestamp(t.time) and 
to_date('01/03/2009', 'DD/MM/YYYY')>= to_timestamp(t.time) and
tc2.field='status'and 
tc2.oldvalue='closed'and 
tc2.newvalue='reopened') and 
tc.field='resolution' and
tc.newvalue='fixed' ) cuenta


But when I use Dynamic Variables in dates:
$FECHAINI

$FECHAFIN

for a report like: http://172.30.2.2/trac/report/62?FECHAINI=09/01/2009&FECHAFIN=13/02/2009

select sum(cuenta.Reabiertos) as "Casos Re-Abiertos Totales",sum (cuenta.Total) as "Casos Totales",to_char(sum(cuenta.Reabiertos)*100/sum(cuenta.Total),'99.9') as "%"
from
(select count (distinct (tt.id)) as Total,0 as Reabiertos
from ticket tt
where
tt.reporter='soporteoperaciones'and 
to_date('$FECHAINI', 'DD/MM/YYYY')<=to_timestamp(tt.time) and 
to_date('$FECHAFIN', 'DD/MM/YYYY')>= to_timestamp(tt.time) 
union all
select 0 as Total,count (distinct (tc.ticket)) as Reabiertos
from ticket_change tc
where
tc.ticket in (select  t.id as ID
from ticket_change tc2,ticket t
where
t.id=tc2.ticket and
t.reporter='soporteoperaciones'and 
to_date('$FECHAINI', 'DD/MM/YYYY')<=to_timestamp(t.time) and 
to_date('$FECHAFIN', 'DD/MM/YYYY')>= to_timestamp(t.time) and
tc2.field='status'and 
tc2.oldvalue='closed'and 
tc2.newvalue='reopened') and 
tc.field='resolution' and
tc.newvalue='fixed' ) cuenta


I've got an error

''Report execution failed: list index out of range''

Attachments (0)

Change History (9)

comment:1 by fermaf@…, 15 years ago

Priority: lownormal
Severity: minornormal

comment:2 by Christian Boos, 15 years ago

Keywords: needinfo added

Which database backend are you using?

comment:3 by fermaf@…, 15 years ago

The Database is PostgreSQL 8.1.11 running in redhat 4 32bits (the same server where is trac).

By the way, the custom queries I posted are generic I mean, they can run in any default trac implementation.

comment:4 by Christian Boos, 15 years ago

Keywords: needinfo removed
Milestone: 0.11.6

Well, no, the time manipulation functions are unfortunately very DB specific. For example, your query won't work with SQLite (no such function: to_timestamp).

But with a PostgreSQL db, the problem can indeed be reproduced (at least on 0.11-stable). Did you try on trunk by any chance?

comment:5 by fermaf@…, 15 years ago

No, I am not able to implement other (newer) version to check if the problem is fixed. Did you check (or are you able to check) if this problem is fixed in a newer version?

comment:6 by Ryan J Ollos, 9 years ago

Milestone: next-minor-0.12.xnext-stable-1.0.x

comment:7 by Ryan J Ollos, 7 years ago

Milestone: next-stable-1.0.xnext-stable-1.2.x

Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.

comment:8 by Ryan J Ollos, 4 years ago

Milestone: next-stable-1.2.xnext-stable-1.4.x

comment:9 by Ryan J Ollos, 8 months ago

Milestone: next-stable-1.4.xnext-stable-1.6.x

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.