Jump to content

Drill Down Charts using iReport 3.7.0


aviral7187

Recommended Posts

Hi,

I started working with iReports a week back, and found it really good. But now i am stuck with an issue. I dont know how to create a drill down chart.

I have made 3 charts using chartspro. The first chart gives the total sales for 3 months, the second is total sales breakdown zone wise, the third is total sales break down city wise in each zone.

I want to make a drill down chart, where, when the user clicks the columns representing the monthly total on the 1st chart, the 2nd chart comes up for that month, and when the user clicks on the zone column in the second chart, the 3rd chart comes up.

I have tried including subreports, but that doesnt solve the purpose.

Any help would be appreciated.

 

Thanks

Aviral

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

I'm actually having a problem creating a drill-down as well (see my earlier post regarding FusionMaps), so take my answer with a grain of salt, but I think that instead of sub-reports, what you need to do is add hyperlinks so that when you click something in one report, it does an "Report Execution" hyperlink to the second report and passes a parameter of the value you need.  Like if chart 1 has three columns for different states that are listed across the top, you go into the hyperlink section of the chart data series definition and make it call the report with the state value as a parameter.  Naturally, report #2 needs to accept a state value as a parameter.  Likewise for going from chart 2 to 3. 

Another recommendation I have is to add a static text  (or maybe it has to be a text field--I forget) to report #2 that is a hyperlink with no parameter associated with it to link back to report #1.  The text would be something like "Return to all states" (even though the user might have run this report directly and not be "returning" to anything).  Similarly, on report #3, put some text at the top of the screen for "Return to all zones" or whatever to take you "back" to report #2.

At least, that's what I'm trying to do.  As you can see from my 9/27 posting, I haven't gotten it to work so far...even the simple link back to my top level report doesn't work, mainly because I seem to have real problems specifying a report in the repository.  I've tried many combinations of "repo:", slashes and no slashes, pathname from a copy/paste of the properties of a report vs. the labels in the repository tree, etc., but none of my attempts work so far.  Similarly, I can't even define a background image that I've added as a resource on a report.  I can get that to work on my hard drive copy of a report by just storing the image in the same directory as the report jrxml, but once I try doing it with the repository, I just haven't found the correct way to reference it.  My latest guess (wrong) looks like this:

<fw:widgetProperty name="bgSWF">
                        <fw:propertyExpression><![CDATA['repo:/organizations/organization_1/Reports/Share_Balances_Pyramid_Chart/Resources/pyramid3.jpg']]></fw:propertyExpression>
                    </fw:widgetProperty>

 

And here's my (non-working) section of jrxml I have in a report-for-a-single-state hyperlink to take you back to the top level report for all states:

 


            <textField hyperlinkType="ReportExecution">
                <reportElement x="351" y="0" width="204" height="20" forecolor="#0000CC"/>
                <textElement textAlignment="Right" markup="none">
                    <font size="10" isBold="true" isUnderline="true"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA["Click here to see totals by state"]]></textFieldExpression>
                <hyperlinkParameter name="_report">
                    <hyperlinkParameterExpression><![CDATA["/organizations/organization_1/Reports/FusionMapAccountsByState"]]></hyperlinkParameterExpression>
                </hyperlinkParameter>
            </textField>

If this helps and you actually get it working, please get back to me and let me know what the piece is that I left out or how to correct my path name (I realize your path name is likely to be different, but if you get a pathname to work and can also show what the iPath tree of the repository navigator looks like that goes with that, I assume I could make the translation to my situation).  Good luck!

 

Carl

 

 

Link to comment
Share on other sites

A quick update for you:

I got my drilldown to work both directions!

For the individual state report (the equivalent of your chart#2), I made a Text Field (NOT Static Text) that was bold and underlined with the text "Click here to see totals by state".  Then I brought up the Repository Navigator, clicked on the main entry (higher even than the jrxml name) for the report that I wanted to link to (the equivalent of your chart #1) and dragged that report name over to the Text Field on my mock report in the design area.  That brings up a hyperlink dialog.  The documentation I'd read said that you can just "Okay" it, that it already has everything filled in correctly.  I did not find that to be the case.  If it doesn't work for you either, you can right click on the Text Field in your design area and select "Hyperlink" to bring that Dialog back up.  Hyperlink target depends on where you want the new report to appear.  I chose "Self" to make it replace the current report on the screen.  For Hyperlink type, choose "Report Execution".  You don't need anything in Reference, Anchor, Page, or Tooltip.  For Link parameters, mine automatically filled in a parameter name of _report (I've never seen this in the documentation) and an Expression of "/organizations/organization_1/Reports/FusionMapAccountsByState", but the expression should REALLY be "repo:/Reports/FusionMapAccountsByState" (at least in my case).  Getting that expresson right was the key.

Armed with that success, I was able to do the slightly more complicated task of getting my fusion map to link to the individual state report, passing in the state abbreviation of the state selected as a parameter.  It might be a little different for your crosstab than it is for a map, but I'm sure parts will be similar.  Under Map Data | Entities, I added an Entity.  On the Data tab I entered an Id Expression of $F{ADDRESS_STATE} and a Value Expression of $F{COUNT}.  So far, that just makes the map display the count in the appropriate state (and also allows color coding, incidentally).  But in addition to the Data tab, there's also an Item Hyperlink tab.  On this tab, I again selected "Self" and "ReportExecution" from some dropdowns, ignored the tabs labeled Reference, Anchor, Page, and Tooltip, and on the tab labeled "Link parameters", I added TWO parameters this time.  One is called _report and the Expression is "repo:/Reports/OpenAccountsSingleState" (the equivalent of your chart #2 report), and the other parameter is called TargetState (the name of the parameter my second report needs), with an Expression of $F{ADDRESS_STATE}.

I'm very happy with my first drill-down report, and I hope this helps you get yours working as well!

Carl

Link to comment
Share on other sites

  • 1 year later...

The drilldown report works fine in a loop i.e. from parent to child and vice-versa, except for the case when we want to pass a parameter from parent to child which is not used as an input control in child. The parameter used in parent's hyperlink link parameter is effective in child if child uses that as an input control but if we want to pass something to child which child only wants to use as a trace back to parent (in cases where parent needs to filter data using this parameter) then creating an input control for that parameter in child is a waste. Any views?



Post Edited by arnav_negi at 10/11/2011 10:14
Link to comment
Share on other sites

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...