KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

BUG : Table Widget doesn't show a column called 0 #337

Open Keith Burke opened this topic on on Jun 27, 2018 - 2 comments

Keith Burke commented on Jun 27, 2018

Hi,

Just noticed a weird one. I have a query with columns called '0','1','2','3','4' etc The Table widget displays them all except the column called '0'. If I rename column '0' to 'xx', it gets displayed.

I assume this isn't by design?

KoolReport commented on Jun 28, 2018

It is not by design, however we do assume that column name is string type. When it comes to the number name, it may happen that php trying to convert value to number and cause unexpected result like this. We will investigate the case, could you please provide me your query. For now, may me you name your column as c0, c1. It will help to solve the issue.

Keith Burke commented on Jun 28, 2018

Thanks. Original query is in a view in MySQL. In KoolReports, I just select * with a where clause to the inputs controls.

The purpose of the query is to show an hourly trend every hour for a date period. To be honest, I wouldn't put too much time into fixing this. Great if you could with minimal work but I can just rename the columns.

    SELECT 
        `g`.`gym_name` AS `Gym`,
        `a`.`entry_datetime` AS `Date`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 0) THEN 1
            ELSE 0
        END) AS `.0`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 1) THEN 1
            ELSE 0
        END) AS `1`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 2) THEN 1
            ELSE 0
        END) AS `2`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 3) THEN 1
            ELSE 0
        END) AS `3`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 4) THEN 1
            ELSE 0
        END) AS `4`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 5) THEN 1
            ELSE 0
        END) AS `5`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 6) THEN 1
            ELSE 0
        END) AS `6`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 7) THEN 1
            ELSE 0
        END) AS `7`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 8) THEN 1
            ELSE 0
        END) AS `8`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 9) THEN 1
            ELSE 0
        END) AS `9`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 10) THEN 1
            ELSE 0
        END) AS `10`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 11) THEN 1
            ELSE 0
        END) AS `11`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 12) THEN 1
            ELSE 0
        END) AS `12`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 13) THEN 1
            ELSE 0
        END) AS `13`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 14) THEN 1
            ELSE 0
        END) AS `14`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 15) THEN 1
            ELSE 0
        END) AS `15`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 16) THEN 1
            ELSE 0
        END) AS `16`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 17) THEN 1
            ELSE 0
        END) AS `17`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 18) THEN 1
            ELSE 0
        END) AS `18`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 19) THEN 1
            ELSE 0
        END) AS `19`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 20) THEN 1
            ELSE 0
        END) AS `20`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 21) THEN 1
            ELSE 0
        END) AS `21`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 22) THEN 1
            ELSE 0
        END) AS `22`,
        (CASE
            WHEN (HOUR(`a`.`entry_datetime`) = 23) THEN 1
            ELSE 0
        END) AS `23`,
        1 AS `Total`
    FROM
        (`ff_access_history` `a`
        JOIN `ff_gyms` `g` ON ((`a`.`gym_id` = `g`.`id`)))

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
bug

None