Jump to content
  • Passing a list of values from HTLM5 chart hyperlink


    Friendly User
    • Features: Charts Product: JasperReports® Library

    Scenario:

    You have a pie chart with a category and a measure. When clicking on the slice you want to drill down into another report that will pass a list of values associated with the slice. For example, you display a chart with number of orders per country. You drilldown to another chart that shows the number of orders for a city. You want to pass a list of cities in that country to the drill down report and display number of orders for each city in the country. How to achieve that?


    Solution:

    To achieve this in your report do the following:

    1. Create a group and a sort field on the field that you use for category

    2. Create a new variable of type string with expression like this:

      $V{Variable_1}+","+$F{SHIPCITY}
      

      Initial value expression needs to be set to "", reset type: Group, calculation function: highest

    3. In your chart create a new measure. Mark it as hidden (small checkbox under measure name). Set the calculation type to Nothing. Set the following value expression:

      Arrays.asList($V{Variable_1}.substring(1).split(","))
      

      The measure type needs to be set to java.lang.Object.

    4. Now in your non-hidden measure go to hyperlink properties. In the properties of the parameter that you pass using the hyperlink select Use Measure Value and there select your hidden measure from the dropdown.

    Target report needs to have an input control available so the parameters can be passed.

    Attached are the reports that can be imported into your JasperServer and used with Sample Data source / Sugar CRM

    export6.zip


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...