Returning a value from Sub Report to Main Report -
i followed this thread try returning values metrics.lines_of_code_1
, metrics.maintainability_1
sub report main report, value null. jrxml files found below:
main report
<?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="report7" language="groovy" pagewidth="842" pageheight="595" orientation="landscape" columnwidth="802" leftmargin="20" rightmargin="20" topmargin="20" bottommargin="20" uuid="fd6ce9ca-1ecb-4541-b6b2-446f4da339de"> <property name="ireport.jasperserver.reportunit" value="/saw/database/report7"/> <property name="ireport.jasperserver.url" value="http://172.16.230.131:8081/jasperserver/ser vices/repository"/> <parameter name="subreport_dir" class="java.lang.string" isforprompting="false"> <defaultvalueexpression><![cdata["/users/mjohansson/downloads/"]]></defaultvalueexpression> </parameter> <parameter name="parametermainreport" class="java.lang.string"/> <querystring language="mongodbquery"> <![cdata[{ 'collectionname':'benchmark', sort:{productivityandprocessmetrics.operationalcost.overallcost:-1} }]]> </querystring> <field name="systemid" class="java.lang.string"/> <field name="productivityandprocessmetrics.operationalcost.overallcost" class="java.lang.double"/> <variable name="metrics.lines_of_code_1" class="java.lang.double" resettype="none" calculation="system"/> <variable name="metrics.maintainability_1" class="java.lang.double" resettype="none" calculation="system"/> <title> <band height="20"> <statictext> <reportelement uuid="248b1d82-f1a8-4a3e-8fab-58ed34517b9c" x="0" y="0" width="175" height="20"/> <box> <toppen linewidth="1.0"/> <leftpen linewidth="1.0"/> <bottompen linewidth="1.0"/> <rightpen linewidth="1.0"/> </box> <textelement> <font isbold="true"/> </textelement> <text><![cdata[system id]]></text> </statictext> <statictext> <reportelement uuid="a2b5c406-76a0-4ffa-b84f-fcf17d43a768" x="275" y="0" width="125" height="20"/> <box> <toppen linewidth="1.0"/> <leftpen linewidth="1.0"/> <bottompen linewidth="1.0"/> <rightpen linewidth="1.0"/> </box> <textelement textalignment="right"> <font isbold="true"/> </textelement> <text><![cdata[loc]]></text> </statictext> <statictext> <reportelement uuid="26c40738-a9c9-4e3a-8f32-2d69f38be204" x="175" y="0" width="100" height="20"/> <box> <toppen linewidth="1.0"/> <leftpen linewidth="1.0"/> <bottompen linewidth="1.0"/> <rightpen linewidth="1.0"/> </box> <textelement textalignment="right"> <font isbold="true"/> </textelement> <text><![cdata[maintenancecost]]></text> </statictext> <statictext> <reportelement uuid="2cca751f-1ffa-4c6e-855c-24c5bf4a9b3f" x="400" y="0" width="125" height="20"/> <box> <toppen linewidth="1.0"/> <leftpen linewidth="1.0"/> <bottompen linewidth="1.0"/> <rightpen linewidth="1.0"/> </box> <textelement textalignment="right"> <font isbold="true"/> </textelement> <text><![cdata[maintainability]]></text> </statictext> </band> </title> <detail> <band height="21" splittype="stretch"> <textfield isblankwhennull="true"> <reportelement uuid="1510b437-bfe1-4610-aeea-78c24d5f0c42" x="0" y="1" width="175" height="20" isremovelinewhenblank="true"/> <box> <toppen linewidth="0.0"/> <leftpen linewidth="0.0"/> <bottompen linewidth="0.0"/> <rightpen linewidth="0.0"/> </box> <textelement/> <textfieldexpression> <![cdata[($f{productivityandprocessmetrics.operationalcost.overallcost}!=null)?$f{systemid}:""]]></textfieldexpression> </textfield> <subreport> <reportelement uuid="2252d608-802e-442f-a3ee-07619e955640" x="275" y="1" width="250" height="20" isremovelinewhenblank="true"/> <subreportparameter name="systemid"> <subreportparameterexpression><![cdata[($f{productivityandprocessmetrics.operationalcost.overallcost}!=null)?$f{systemid}:null]]></subreportparameterexpression> </subreportparameter> <subreportparameter name="parametersubreport"> <subreportparameterexpression><![cdata[$p{parametermainreport}]]></subreportparameterexpression> </subreportparameter> <connectionexpression><![cdata[$p{report_connection}]]></connectionexpression> <returnvalue subreportvariable="metrics.lines_of_code_1" tovariable="metrics.lines_of_code_1"/> <returnvalue subreportvariable="metrics.maintainability_1" tovariable="metrics.maintainability_1"/> <subreportexpression><![cdata["repo:report7_subreport1.jrxml"]]></subreportexpression> </subreport> <textfield pattern="#,##0.00" isblankwhennull="true"> <reportelement uuid="d81f0296-7dff-4cdc-9d48-ec477154fc0e" x="175" y="1" width="100" height="20" isremovelinewhenblank="true"/> <textelement textalignment="right"/> <textfieldexpression><![cdata[$f{productivityandprocessmetrics.operationalcost.overallcost}]]></textfieldexpression> </textfield> <textfield> <reportelement uuid="4c995889-51aa-42db-8e44-ef169372330c" x="525" y="1" width="100" height="20"/> <textelement/> <textfieldexpression><![cdata[$v{metrics.lines_of_code_1}]]></textfieldexpression> </textfield> <textfield> <reportelement uuid="fb61c381-1862-4817-a7ad-23f24d142e6a" x="625" y="1" width="100" height="20"/> <textelement/> <textfieldexpression><![cdata[$v{metrics.maintainability_1}]]></textfieldexpression> </textfield> </band> </detail> </jasperreport>
sub report
<?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="report7_subreport1" language="groovy" pagewidth="250" pageheight="802" columnwidth="250" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" uuid="3ec7fa69-029a-4882-8308-8496807fe30d"> <property name="ireport.jasperserver.reportunit" value="/saw/database/report7"/> <property name="ireport.jasperserver.url" value="http://172.16.230.131:8081/jasperserver/services/repository"/> <parameter name="parametersubreport" class="java.lang.string"/> <parameter name="systemid" class="java.lang.string"> <parameterdescription><![cdata[]]></parameterdescription> </parameter> <querystring language="mongodbquery"> <![cdata[{ 'collectionname':'systemmetrics', 'findqueryregex':{lang:'/^all_languages_aggregate/' ,sysid:'/^$p!{systemid}/'} }]]></querystring> <field name="metrics.lines_of_code" class="java.lang.double"/> <field name="metrics.maintainability" class="java.lang.double"/> <field name="sysid" class="java.lang.string"/> <variable name="metrics.lines_of_code_1" class="java.lang.double" resettype="none"> <variableexpression><![cdata[$f{metrics.lines_of_code}]]></variableexpression> </variable> <variable name="metrics.maintainability_1" class="java.lang.double" resettype="none"> <variableexpression><![cdata[$f{metrics.maintainability}]]></variableexpression> </variable> <background> <band splittype="stretch"/> </background> <summary> <band height="20"> <textfield pattern="#,##0.00" isblankwhennull="true"> <reportelement uuid="48938680-a5b7-4d16-b3e0-79e02a43336c" x="0" y="0" width="125" height="20"/> <textelement textalignment="right"/> <textfieldexpression><![cdata[$v{metrics.lines_of_code_1}]]></textfieldexpression> </textfield> <textfield pattern="#,##0.00" isblankwhennull="true"> <reportelement uuid="59f69b58-fd5c-44a8-abdd-410e30d48627" x="125" y="0" width="125" height="20"/> <textelement textalignment="right"/> <textfieldexpression><![cdata[$v{metrics.maintainability_1}]]></textfieldexpression> </textfield> </band> </summary> </jasperreport>
what doing wrong? input helpful.
i solved my-self setting evaluation time on field calling output variable "now" "auto".
Comments
Post a Comment