Jump to content
We've recently updated our Privacy Statement, available here ×

crosstab returnmap put error


rcmpjames

Recommended Posts

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

  • Replies 11
  • Created
  • Last Reply

Top Posters In This Topic

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

  • 3 weeks later...

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

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

  • 3 weeks later...

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

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