Edgewall Software
Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#13314 closed defect (worksforme)

Report SQL "id as _id" does not show link

Reported by: anonymous Owned by:
Priority: normal Milestone:
Component: report system Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

TracReports#column-syntax documents:

id as _id will hide the Id column but the link to the ticket will be present.

But it does not seem to work, for example with this report:

-- Defaults:
-- PREFIX=

SELECT name, name as _id, 
  CASE
    WHEN due=0 THEN '2 Open (No due date)'
    WHEN completed=0 THEN '1 Open'
    ELSE '3 Closed'
  END as state,
  'milestone' AS _realm
FROM milestone
WHERE name LIKE $PREFIX||'%'
ORDER BY state, completed DESC

The links are not shown. (name as id works, but has the wrong column title.)

Attachments (0)

Change History (4)

comment:1 by Jun Omae, 5 years ago

Resolution: worksforme
Status: newclosed

The _id column expects ticket record exists. If you want to link to the milestone, use 'milestone' AS realm column.

See CookBook/Configuration/Reports#OverviewfornextMilestones.

comment:2 by anonymous, 5 years ago

use 'milestone' AS realm column.

I already did.

The cookbook example has the same problem: Using _id to hide the wrong name doesn't work.

Not a major problem of course, but the documentation suggests this would work.

comment:3 by anonymous, 5 years ago

After looking at the source apparently in my specific case I can use name as milestone to get a working link (without the inappropriate id column title):

-- Defaults:
-- PREFIX=

SELECT name as milestone, 
  CASE
    WHEN due=0 THEN '2 Open (No due date)'
    WHEN completed=0 THEN '1 Open'
    ELSE '3 Closed'
  END as state,
  'milestone' AS _realm -- not really needed
FROM milestone
WHERE name LIKE $PREFIX||'%'
ORDER BY state, completed DESC

(And then the 'milestone' AS _realm is even superfluous and could also be omitted.)

in reply to:  2 comment:4 by Jun Omae, 5 years ago

Replying to 匿名:

use 'milestone' AS realm column.

I already did.

Sorry. I just missed it.

The cookbook example has the same problem: Using _id to hide the wrong name doesn't work.

However, the example in cookbook works fine. Also, query in your report is wrong.

The _id column should be id because column started with _ is NOT shown.

-SELECT name, name as _id,
+SELECT name as id, 

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


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