rcmpjames Posted April 17, 2007 Share Posted April 17, 2007 Hi, Getting "Error evaluating expression : Source text : $P{crossTabReturnMap}.put("totals", $V{activityCount_Infrastructure_Community_ALL})" Where the crossTabReturnMap is pointing to a variable passed to the main report (this is a sub) and the activityCount, activityCount_Infrastructure and activityCount_Community are all Integers I have the exact same code in another report/subreport/crosstab that works no problem. Any ideas where to look and/or how to troubleshoot this? The Stack trace does not help... Link to comment Share on other sites More sharing options...
rcmpjames Posted April 19, 2007 Author Share Posted April 19, 2007 ...just wondering if anyone can help - still digging. thanks. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted April 19, 2007 Share Posted April 19, 2007 Hi, You mention several variables here: activityCount, activityCount_Infrastructure and activityCount_Community.But where are they? Without attaching relevant files is impossible to tell what is happening. Thanks,Teodor Link to comment Share on other sites More sharing options...
rcmpjames Posted April 19, 2007 Author Share Posted April 19, 2007 Link to comment Share on other sites More sharing options...
Teodor Danciu Posted April 19, 2007 Share Posted April 19, 2007 Hi, The initial error you posted says something about an expression in which you put a value in the crossTabReturnMap. But I don't see this expression in the JRXML you posted. Thanks,Teodor Link to comment Share on other sites More sharing options...
rcmpjames Posted April 20, 2007 Author Share Posted April 20, 2007 Ha - of course not - I took it out...! Sorry - long day/week/month Code: <staticText> <reportElement x="0" y="0" width="0" height="25" key="staticText"> <printWhenExpression><![CDATA[$P{crossTabReturnMap}.put("totals2", new Integer(1))]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <text><![CDATA[static Text]]></text> </staticText> <staticText> <reportElement x="0" y="0"2 width="0" height="25" key="staticText"> <printWhenExpression><![CDATA[$P{crossTabReturnMap}.put("nototals2", new Integer(1))]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <text><![CDATA[static Text]]></text> </staticText> Link to comment Share on other sites More sharing options...
Teodor Danciu Posted April 20, 2007 Share Posted April 20, 2007 Hi, The <printWhenExpression> expects the output to be a java.lang.Boolean. The Map.put() method actually returns null or the previous object that was found in the map for the specified key, which is probably not a Boolean, but rather an Integer. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
rcmpjames Posted May 8, 2007 Author Share Posted May 8, 2007 hmmmm... kind of odd that the seemingly exact same code works in another crosstab... I will keep an eye on it. What would be the proper syntax to return a measure's value from a crosstab, then? Link to comment Share on other sites More sharing options...
rcmpjames Posted May 9, 2007 Author Share Posted May 9, 2007 Okay, solved it... For anyone having this probelm - I derived my solution from a combination of things - primarily using a "dummy expression" to fill the map, and using the printWhenExpression to render it. I just needed to add a dummy expression within the dummy expression involving the population of the map that would return a boolean value to keep the printWhenExpression happy. Link to comment Share on other sites More sharing options...
rcmpjames Posted May 17, 2007 Author Share Posted May 17, 2007 Got another problem - how the heck do I use the return values in groups... I get values back, but want to sum them in a higher-level grouping. Right now, I try to put a get from the Map into a variable, then set the calcluation to sum at the group level for the group I want it summed for... but just get nulls. Any ideas? Thanks. Link to comment Share on other sites More sharing options...
rcmpjames Posted June 6, 2007 Author Share Posted June 6, 2007 Maybe some code would help... I am getting weird totals when I try to get sums from a crosstab return map. I fill the map like this: Code: <staticText> <reportElement x="0" y="0" width="0" height="25" key="staticText"> <printWhenExpression><![CDATA[new Boolean((((Integer)$P{crossTabReturnMap}.put("totals", $V{activityCount_ActivityDescription_DetachmentDescription_ALL}))).intValue() > 0)]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <text><![CDATA[static Text]]></text> </staticText> <staticText> <reportElement x="0" y="0" width="0" height="25" key="staticText"> <printWhenExpression><![CDATA[new Boolean((((Integer)$P{crossTabReturnMap}.put("intotals", $V{activityReviewYes_ActivityDescription_DetachmentDescription_ALL}))).intValue() > 0)]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <text><![CDATA[static Text]]></text> </staticText> <staticText> <reportElement x="0" y="0" width="0" height="25" key="staticText"> <printWhenExpression><![CDATA[new Boolean((((Integer)$P{crossTabReturnMap}.put("outtotals", $V{activityReviewNo_ActivityDescription_DetachmentDescription_ALL}))).intValue() > 0)]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <text><![CDATA[static Text]]></text> </staticText> <staticText> <reportElement x="0" y="0" width="0" height="25" key="staticText"> <printWhenExpression><![CDATA[new Boolean((((Integer)$P{crossTabReturnMap}.put("completetotals", $V{activityReviewComplete_ActivityDescription_DetachmentDescription_ALL}))).intValue() > 0)]]></printWhenExpression> </reportElement> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> <text><![CDATA[static Text]]></text> </staticText> The crossTabReturnMap is passed into a variable named districtActivityMap, which is used by various variables in various groups on the main report. Declaration and use: Code:[code]<variable name="districtActivityMap" class="java.util.Map" resetType="Group" resetGroup = "Division" calculation="System"> </variable> <variable name="divisionYesTotals" class="java.lang.Integer" resetType="Group" resetGroup="Division" calculation="Sum"> <variableExpression><![CDATA[$V{districtActivityMap}.get("totals"«»)]]></variableExpression> <initialValueExpression><![CDATA[new java.lang.Integer(0)]]></initialValueExpression> </variable> <variable name="regionYesTotals" class="java.lang.Integer" resetType="Group" resetGroup="Region" calculation="Sum"> <variableExpression><![CDATA[$V{districtActivityMap}.get("totals"«»)]]></variableExpression> <initialValueExpression><![CDATA[new java.lang.Integer(0)]]></initialValueExpression> </variable> <variable name="divisionInTotals" class="java.lang.Integer" resetType="Group" resetGroup="Division" calculation="Sum"> <variableExpression><![CDATA[$V{districtActivityMap}.get("intotals"«»)]]></variableExpression> <initialValueExpression><![CDATA[new java.lang.Integer(0)]]></initialValueExpression> </variable> <variable name="regionInTotals" class="java.lang.Integer" resetType="Group" resetGroup="Region" calculation="Sum"> <variableExpression><![CDATA[$V{districtActivityMap}.get("intotals"«»)]]></variableExpression> <initialValueExpression><![CDATA[new java.lang.Integer(0)]]></initialValueExpression> </variable> <variable name="divisionOutTotals" class="java.lang.Integer" resetType="Group" resetGroup="Division" calculation="Sum"> <variableExpression><![CDATA[$V{districtActivityMap}.get("outtotals"«»)]]></variableExpression> <initialValueExpression><![CDATA[new java.lang.Integer(0)]]></initialValueExpression> </variable> <variable name="regionOutTotals" class="java.lang.Integer" resetType="Group" resetGroup="Region" calculation="Sum"> <variableExpression><![CDATA[$V{districtActivityMap}.get("outtotals"«»)]]></variableExpression> <initialValueExpression><![CDATA[new java.lang.Integer(0)]]></initialValueExpression> </variable> <variable name="divisionCompleteTotals" class="java.lang.Integer" resetType="Group" resetGroup="Division" calculation="Sum"> <variableExpression><![CDATA[$V{districtActivityMap}.get("completetotals"«»)]]></variableExpression> <initialValueExpression><![CDATA[new java.lang.Integer(0)]]></initialValueExpression> </variable> <variable name="regionCompleteTotals" class="java.lang.Integer" resetType="Group" resetGroup="Region" calculation="Sum"> <variableExpression><![CDATA[$V{districtActivityMap}.get("completetotals"«»)]]></variableExpression> <initialValueExpression><![CDATA[new java.lang.Integer(0)]]></initialValueExpression> </variable> The numbers do not add up. I am testing in the subreport; they are correct - the sums on the main report are calculated, but not at all correctly. ...HELP! Link to comment Share on other sites More sharing options...
rcmpjames Posted June 7, 2007 Author Share Posted June 7, 2007 100 views since I last updated - are there ANY opinions? 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