Whenever I leave out the "as id" I get an error, "KeyError: 'id'". From what I can tell, creating a report requires "as id" somewhere in the query or it just doesn't work. I can hide it with "_id", but it's still got to be in there.
On Sunday, April 28, 2013 6:01:07 PM UTC-4, hasienda wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 24.04.2013 02:19, Chris wrote: > > I'm generating a report with the following query: > > > > SELECT owner as id, > > (SELECT count(*) FROM ticket b WHERE b.owner=a.owner AND status = 'new') > > as New, > > (SELECT count(*) FROM ticket b WHERE b.owner=a.owner AND status = > > 'assigned') as Assigned, > > (SELECT count(*) FROM ticket b WHERE b.owner=a.owner AND status = > > 'fixed') as Fixed, > > (SELECT count(*) FROM ticket b WHERE b.owner=a.owner AND status = > > 'verified') as Verified, > > (SELECT count(*) FROM ticket b WHERE b.owner=a.owner AND status = > > 'closed') as Closed, > > (SELECT count(*) FROM ticket b WHERE b.owner=a.owner AND status = > > 'hold') as Hold > > FROM ticket a > > WHERE status <> '' > > GROUP BY owner > > > > Which gives me something like: > > > > Id | New | Assigned | Fixed | Verified | Closed | Hold > > --------------------------------------------------------------- > > #user1 | 8 | 0 | 14 | 2 | 2 | 12 > > #user2 | 2 | 10 | 1 | 0 | 5 | 2 > > #user3 | 18 | 5 | 4 | 0 | 8 | 5 > > #user4 | 1 | 1 | 0 | 1 | 1 | 0 > > > > Is there a way to get the "#user1" to lose the "#" symbol and link > > somewhere useful? > > While I've to guess, I'm still pretty sure, that the 'owner as id' makes > your owners become formatted like ticket numbers. If you just drop the > 'as id' the extra '#' should vanish. > > On the second request there's not much to be done. There could be a > sensible query showing user's ticket, but TracReports have not magic > that I know of to create such links in the query output. It might be > done by a simple Trac plugin, that mangles and rewrites the template > after it got rendered (see post_process_request of IRequestFilter [1]). > > Steffen Hoffmann > > > [1] > > http://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.web.api.IRequestFilter > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAlF9nCIACgkQ31DJeiZFuHcY1gCgsT3znBgyu8p34NBPeTSTFjtR > fNYAn2imRuidTCK72iJlGDBOx9X+4ORC > =dLml > -----END PGP SIGNATURE----- > -- You received this message because you are subscribed to the Google Groups "Trac Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/trac-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
