cbarlow3 Posted September 27, 2010 Share Posted September 27, 2010 I'm having two issues trying to create a report that uses a FusionMap of the USA states:1. I don't seem to be able to make the states change color based on the value. In iReport under "Map Properties" | "Color Ranges" I've defined three ranges, each with no overlap and associated with a different color. Under "Map Properties" | "Map Data" | "Entities", I have a single entity defined with an "Id Expression" of "$F{ADDRESS_STATE} and a "Value Expression" of "$F{COUNT}" but no "Label Expression" or "Color Expression". I can't find documentation on what "Color Expression" does. So far, the map shows up, and the count appears when you view a tooltip for a state (I could also put $F{COUNT} as the "Label Expression" if I wanted the count to appear instead of the state name). Any idea how I tie the entity to the color ranges in iReport?2. The other thing I'd like to do is turn my map into a drill-down. Clicking a state and having it pull up another state map might be too complicated using only iReport and JasperServer, plus our database doesn't have county codes anyway. But I do have a text report defined that has a parameter for $P{TargetState} (and then lists total count by city), and it would be nice to be able to pull that report up, passing the abbreviation (id) for the state clicked on the FusionMap. I've seen one example of how to create a hyperllink from one report to another by dragging and dropping in iReport, but I couldn't get that to work, and besides, the example was from just a text label and without passing a parameter. I'm guessing that I need to fill out some fields in the "Item Hyperlink" tab of the Entity, but I'm at a loss how to fill out the "Reference", "Anchor", "Page", "Link Parameters" and "Tooltip" tabs underneath the "Item Hyperlink" tab. For "Hyperlink target", I selected "Blank" (I think this only affects where the new report shows up...separate window, inside current frame, etc.). For "Hyperlink Type" I selected "ReportExecution". I think what I'm missing is how to fill in these subtabs to identify which report to run and how to pass the state-selected Id as a parameter called $P{TargetState}Any help from an experienced FusionMap user would be appreciated! The FusionMap documentation seems geared towards programmers writing code that generates XML, etc. on the fly for JasperReports library rather than for iReport/JasperServer users.Code:<?xml version="1.0" encoding="UTF-8"?><jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Fusion Map 2" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <queryString> <![CDATA[sELECT ADDRESS."STATE" AS ADDRESS_STATE, COUNT(*)AS COUNTFROM "CORE"."PERSON_ADDRESS_LINK" PERSON_ADDRESS_LINK INNER JOIN "CORE"."ACCOUNT" ACCOUNT ON PERSON_ADDRESS_LINK."SERIAL" = ACCOUNT."MAIL_PERSON_ADDR_LINK_SERIAL" INNER JOIN "CORE"."ADDRESS" ADDRESS ON PERSON_ADDRESS_LINK."ADDRESS_SERIAL" = ADDRESS."SERIAL"WHERE ACCOUNT."CLOSE_DATE" IS NULLGROUP BY ADDRESS."STATE"]]> </queryString> <field name="ADDRESS_STATE" class="java.lang.String"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <field name="COUNT" class="java.lang.Integer"> <fieldDescription><![CDATA[]]></fieldDescription> </field> <background> <band splitType="Stretch"/> </background> <title> <band height="30" splitType="Stretch"> <staticText> <reportElement x="0" y="0" width="245" height="30"/> <textElement> <font size="14" isBold="true"/> </textElement> <text><![CDATA[Open Accounts by State]]></text> </staticText> </band> </title> <summary> <band height="700" splitType="Stretch"> <componentElement> <reportElement x="0" y="0" width="555" height="700"/> <fm:map xmlns:fm="http://jaspersoft.com/fusion" xsi:schemaLocation="http://jaspersoft.com/fusion http://jaspersoft.com/schema/fusion.xsd"> <fm:mapNameExpression><![CDATA["USA"]]></fm:mapNameExpression> <fm:colorRange color="#A7E9BC"> <fm:minValueExpression><![CDATA[0]]></fm:minValueExpression> <fm:maxValueExpression><![CDATA[0]]></fm:maxValueExpression> <fm:labelExpression><![CDATA['None']]></fm:labelExpression> </fm:colorRange> <fm:colorRange color="#FFFFCC"> <fm:minValueExpression><![CDATA[1]]></fm:minValueExpression> <fm:maxValueExpression><![CDATA[5]]></fm:maxValueExpression> <fm:labelExpression><![CDATA['1-5']]></fm:labelExpression> </fm:colorRange> <fm:colorRange color="#FF9937"> <fm:minValueExpression><![CDATA[6]]></fm:minValueExpression> <fm:maxValueExpression><![CDATA[500000]]></fm:maxValueExpression> <fm:labelExpression><![CDATA['>5']]></fm:labelExpression> </fm:colorRange> <fm:mapDataset> <fm:entity> <fm:idExpression><![CDATA[$F{ADDRESS_STATE}]]></fm:idExpression> <fm:valueExpression><![CDATA[$F{COUNT}]]></fm:valueExpression> <fm:hyperlink hyperlinkType="ReportExecution" hyperlinkTarget="Blank"/> </fm:entity> </fm:mapDataset> </fm:map> </componentElement> </band> </summary></jasperReport> Link to comment Share on other sites More sharing options...
cbarlow3 Posted September 27, 2010 Author Share Posted September 27, 2010 I did eventually find out that "Color Expression" is a way to override a color range for a specific entity/value. I have problems picturing how that would work, but for now am satisfied that it means I shouldn't have to fill in "Color Expression", as my whole point is to get the color range to work.Also, I realized it would be handy on my single state report to have a hyperlink back to the fusion map of the U.S.A. (no parameter needed). For that, I tried the technique that I found in my class notes where you drag the linked-to-report-name from the repository and drop it on the text field that you want to be a hyperlink in the linked-from-report. That sort of worked, in that it did automatically bring up the hyperlink dialogue and presumably automatically fills it in correctly so all you have to do is close the dialog, save the report, and replace the (linked-from) report in the repository with the open report file in iReport (using the JS plugin). Not as fancy as the hyperlink going the other direction, so I thought I'd try it out and see if I could learn something that would be useful going the other way from a map click to calling a report with a parameter specific to the location of the click. What I found was that my hyperlink gets an error when I click it: com.jaspersoft.jasperserver.api.JSException: jsexception.view.report.could.not.loadcom.jaspersoft.jasperserver.api.JSException: jsexception.view.report.could.not.load at com.jaspersoft.jasperserver.war.action.ReportParametersAction.createWrappers(ReportParametersAction.java:125) at com.jaspersoft.jasperserver.war.action.ViewReportAction.checkForParams(ViewReportAction.java:199) at com.jaspersoft.ji.report.options.actions.ReportOptionsViewAction.checkForParams(ReportOptionsViewAction.java:61) at sun.reflect.GeneratedMethodAccessor611.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at org.springframework.webflow.action.DispatchMethodInvoker.invoke(DispatchMethodInvoker.java:98) at org.springframework.webflow.action.MultiAction.doExecute(MultiAction.java:123) at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188) at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51) at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:79) at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188) at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145) at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51) at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:101) at org.springframework.webflow.engine.State.enter(State.java:194) at org.springframework.webflow.engine.Flow.start(Flow.java:535) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364) The XML responsible for the link appears below. I've also tried inserting "repo:" right before the first slash, and I've also tried changing the path name to look more like the folder names as they appear in the folder view of the repository (although I doubt that's the problem), but none of those seem to work. I had a similar problem last week when trying to specify a background image on a chart: I could do it with local copies of the reports on my hard drive, but couldn't seem to break the code on how to put the image in the repository (I think I actually did that part correctly...it ended up in a Resources folder under the main folder for that report) and then correctly reference it (tried several different "pathnames", with no success). Code: <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> Link to comment Share on other sites More sharing options...
cbarlow3 Posted September 30, 2010 Author Share Posted September 30, 2010 Got the drilldown to work both directions (from general to specific, passing a parameter and from specific back up to general with no parameter passing required). Here's the secret:When you get to the hyperlink dialog, you don't need a Reference. Instead, you need a Link parameter. The parameter name is _report and the Expression (in my case) is "repo:/Reports/OpenAccountsSingleState". I figured this out by looking at what the drag-and-drop a report title from the repository onto a text field in the design pane does...except that at least for me it automatically fills in the Expression (pathname, essentially) incorrectly. It was filling in something like "/organizations/organization_1/Reports/..." I tried so many combinations of putting "repo:" and "repo:/" in front of that and other versions similar to that until I was blue in the face. Somehow I finally made a good guess of where the pathname should ACTUALLY pick up after "repo:".As for my color coding, the only thing I can think of that I changed was that I changed my colors in the color range section and picked colors with my mouse instead of typing in specific hex codes. Bizarre. Link to comment Share on other sites More sharing options...
cjturner Posted November 15, 2010 Share Posted November 15, 2010 A few months later, it would appear that you are the only Fusion Maps guru in the community. Thanks for posting the answers you did find on your own. Link to comment Share on other sites More sharing options...
Steve Park Posted February 3, 2013 Share Posted February 3, 2013 Hi everyone,Since Fusion is only available in our commercial products, you probably won't find much help on the community website. Assuming you're pro customers, I'd suggest opening a ticket with our support team. Thanks!Steve Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now