Tabbed report with ajax and non-ajax tabs

(4 posts) (2 voices)

Tags:

  1. mumblyomod, Member

    So I've created a report containing the following code:

    DROP PROCEDURE IF EXISTS sp_DBR_my_function $$ CREATE PROCEDURE sp_DBR_my_function(start_date DATE, end_date DATE) BEGIN SELECT 'dbr.title', 'My title'; SELECT 'dbr.tab', 'non-AJAX report'; SELECT 'dbr.tab', 'AJAX report', 'report.php?r=16&m=6&h=5d45935138c075094f4a0fcfefe3a1f76fc56268&embedi=1'; SELECT 'dbr.parameters.show';

    SELECT 'dbr.text', ''; CALL sp_DBR_date_range_test(start_date, end_date); SELECT 'dbr.tab.close';

    END $$

    This loads the results for my initial sp_DBR_date_range_test function just fine, but when I click on the tab for the AJAX report I see the page load, but after loading it immediately reloads the initial non-AJAX tab. Is this expected behavior, if not how should I fix it?

    I should also note that the reason I'm using AJAX to load the second tab is that the data set from that query has the potential to be very large, so I really only want to load it if the end user specifically wants that data.

  2. myDBR Team, Key Master

    The report looks ok. Something in the Ajax report causes the tab to reload. Usually this happens when the 'embedi=1' is omitted from the URL, but you seem to have that in place.

    If you run the Ajax URL (add the host info to the URL), you should see just the content of the tab generated, no full HTML page with links to myDBR JavaScripts.

    --
    myDBR Team

  3. mumblyomod, Member

    I tried your suggestion, but it didn't seem to help. In addition, I've slightly changed the initial report so now both the AJAX and non-AJAX tabs use the same report, they were already nearly identical anyway. The new code for the AJAX report pulls data from all possible date ranges, which is what the original AJAX report did anyway and is as follows:

    SELECT 'dbr.tab', 'AJAX Report', 'https://www.my_real_url.com/mydbr/report.php?r=20&u1=2012-12-31&u2=2112-12-31+17%3A33%3A12&m=4&h=2cec895357af43c5d3cee7d3495ed5f4246d091a&embedi=1';

    The same problem occurs when this report is run and I thought it'd be easier to troubleshoot if you could see the code for the actual report that is running.
    The code for this report is as follows:

    DROP PROCEDURE IF EXISTS sp_DBR_date_range_test $$ CREATE PROCEDURE sp_DBR_date_range_test(start_date DATE ,end_date DATE) BEGIN

    SELECT 'dbr.parameters.show'; SELECT 'dbr.title', concat('Report For Selected Date Range: ', start_date, ' to ', end_date);

    SELECT 'dbr.keepwithnext'; SELECT 'dbr.chart' , 'Bar', 'Graph 1 Title'; SELECT location,count(location) FROM database.table WHERE flag='yes' AND location IS NOT NULL AND location != '' AND DATE(internal_start) BETWEEN start_date AND end_date GROUP BY location ORDER BY location;

    SELECT 'dbr.keepwithnext'; SELECT 'dbr.chart', 'Bar', 'Graph 2 Title', '480'; SELECT 'Value 1' AS 'Type', SUM(column_14_name LIKE 'value1') AS 'Total' FROM database.table WHERE flag = 'yes' AND DATE(internal_start) BETWEEN start_date AND end_date UNION SELECT 'Value 2' AS 'Type', SUM(column_14_name LIKE 'value2') AS 'Total' FROM database.table WHERE flag = 'yes' AND DATE(internal_start) BETWEEN start_date AND end_date UNION SELECT 'Value 3' AS 'Type', SUM(column_14_name LIKE '') AS 'Total' FROM database.table WHERE flag = 'yes' AND DATE(internal_start) BETWEEN start_date AND end_date;

    SELECT 'dbr.chart' , 'Column', 'Graph 3 Title', '180'; SELECT 'Male' AS 'Gender', SUM(gender LIKE 'male') AS 'Total' FROM database.table WHERE flag = 'yes' AND DATE(internal_start) BETWEEN start_date AND end_date UNION SELECT 'Female' AS 'Gender', SUM(gender LIKE 'female') AS 'Total' FROM database.table WHERE flag = 'yes' AND DATE(internal_start) BETWEEN start_date AND end_date;

    SELECT column_1_name as 'Column 1', column_2_name as 'Column 2', column_3_name as 'Column 3', gender as 'Gender', column_4_name as 'Column 4', column_5_name as 'Column 5', column_6_name as 'Column 6', column_7_name as 'Column 7', column_8_name as 'Column 8', column_9_name as 'Column 9', column_10_name as 'Column 10', column_11_name as 'Column 11', column_12_name as 'Column 12', column_13_name as 'Column 13', column_14_name as 'Column 14', column_15_name as 'Column 15', internal_start as 'Start Time', internal_end as 'End Time', column_16_name as 'Column 16', column_17_name as 'Column 17', column_18_name as 'Column 18' FROM database.table WHERE flag = 'yes' AND DATE(internal_start) BETWEEN start_date AND end_date;

    END $$

  4. myDBR Team, Key Master

    Nothing in the report that would cause the problem.

    Please open a support ticket in suppot email, so we can take a close look what is causing your trouble.

    --
    myDBR Team


Reply

You must log in to post.