Jump to content
Changes to the Jaspersoft community edition download ×
  • How to create a Simple Drill-Down Report


    emistry
    • Version: v6.0.1 Product: Jaspersoft® Studio

    Jaspersoft Studio Version: 6.0.1 / Jaspersoft Server Version: 6.0.1

    In this Example I will lead you through the steps needed to demonstrate the Drill-Down report functionality. It will use the Foodmart Database Sample which ships with the Jaspersoft Server.

    Child Report

    Create the Child Report first. Create a Jaspersoft Studio Report using the following SQL:

    SELECT store.store_city,

              store.store_state,

              store.store_country,

              sales_fact_1998.store_sales,

              sales_fact_1998.store_cost,

              sales_fact_1998.unit_sales,

              store.store_manager

    FROM sales_fact_1998

              INNER JOIN store ON

               store.store_id = sales_fact_1998.store_id

               where  store.store_country = $P{Country_P}

     

    Pull the fields over to the blank report and tidy up the unwanted bands such that the Child Report looks like this

    1(84).png.a3b5f5db0d23457b9dd16279768da71f.png

     

    Parent Report

    This example shows drilling down from a Bar Chart taking the Country name as the Drill-Down parameter into the above Child Report.

    Create the Parent Report. Create a Jaspersoft Studio Report using the following SQL:

    SELECT sales_fact_1998.store_sales,

              sales_fact_1998.store_cost,

              sales_fact_1998.unit_sales,

              store.store_country,

              store.store_state

    FROM sales_fact_1998

              INNER JOIN store ON

               store.store_id = sales_fact_1998.store_id

    Delete all the bands except the Summary band in this report. In the Summary band add a HTML5 Bar Chart.

    In the HMTL5 properties add the Country to the Categories and Sales to the Measures.

    2(66).png.f4f557794a23e35c181fcd794cfc5706.png

     

    In the Categories Level for Country, configure as below:

    3(46).png.769eb11ee61cd31f3f835d2af4d0fc8b.png

     

    In the Bucket Properties (of Categories) , configure as below:

    4(39).png.bc0e083c400f5f30329d1dc6c54869e0.png

     

    NOTE: The Bucket Property here must be the same as the Parameter in the Child Report

    In the Measures Level for Sales, configure as below:

    5(36).png.709eb9230f78e5c920b1c66685d9eb1e.png

     

    In the Advanced Properties, select the Hyperlink button and the fields will auto populate as below:

     

    6(25).png.e70c63dc39c764390c37c64f1387c363.png

    Remove the hyperlinkReference property.

    Modify the hyperlinkType property as follows:

    7(16).png.69a1bdd48a6ae5cfa819df40af707836.png

     

    Nothing to do on the hyperlinkTarget, keep as is

    Add a _report property and configure as follows:

    8(15).png.e6e9936aee21a1f359f027096440de28.png

     

    Add a Country_P property and configure as follows:

    9(11).png.a98cc8a2b2183ce587a63403c0630446.png

    Publish both reports to the Jasper Server

    Edit the Child Report, select the Control & Resources tab and change the Display Mode to “In Page” and uncheck the “Always Prompt” option

    You should now be able to goto the Parent Report and select a Bar in the Chart and drill through to the Country Detail (Child) Report.

    The Parent and Child reports are attached here, but remember you will still have to do the step in blue above to get it working as expected.

    When you create the Child Parameter, make sure the "Is for Prompting" dialog is checked otherwise the parameter will not passed to the server

    childreport.jrxml

    parentreport.jrxml


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...