[Trac] Re: custom fields in reports

Jim Cheetham jim at egressive.com
Wed Feb 9 23:59:50 EST 2005


On Wed, 2005-02-09 at 20:22 -0500, Joe wrote:
> Jim Cheetham wrote:
> > I have a remaining minor niggle : the unpopulated custom fields render
> > as the word "None" in the output, and I'd like them to be blank.
> 
> You can use an ifnull(X, Y) expression, e.g., ifnull(c.value, 'None').

Hmmm, I hadn't come across that function before.
However, it didn't do quite what I expected ...
   IFNULL(c.value,0) AS chargeable
made the whole column return as numeric - including the existing fields
that have values like "15m" appearing as "15.0". IFNULL(c.value,"no")
didn't help either.

So I did a little more hacking around and came up with these stanzas,
which work fine ...   

(CASE WHEN c.value ISNULL THEN '' ELSE c.value END) AS charge,
 
Thanks for the inspiration :-) I'll add my current report form to the
wiki ...
http://projects.edgewall.com/trac/wiki/TracIniReportCustomFieldSample

-- 
    -jim cheetham = jim at egressive.com = 03 96 33733 / 021 177 8606
   Customer Services Manager & System Architect @ www.egressive.com
Open Standards, Open Source = The Effusion Group www.effusiongroup.com



More information about the Trac mailing list