Jaspersoft Community 'Read-Only' as of July 8, 2022
Transition to New TIBCO Community Just Weeks Away
You can still search, review wiki content, and review discussions in read-only mode. Please email community@tibco.com with questions or issues requiring TIBCO review or response.
I have tried following things.
$V{REPORT_COUNT}==1 in the Print When Expression
Cheking the BLANK when null
Also putting everything from detail to Summary but then it renders no values.
I will be really glad if someone can help me with this.
This is the link for code http://community.jaspersoft.com/sites/default/files/files/TestReport.txt
4 Answers:
Had this problem as wel, I believe the problem was that I executed my SQL query (Select * (.....) ) accidently on the 'Sample Database' of 'Empty database' instead of the realy Database that actually contained the right records..
Could that be your problem?
This not the case with me. I am using domain based adapter and SQL based. I am connecting to the server and then get access to the database and simply drag the fields. So I am not getting any group By option. That's what I am thinking the issue is.
http://community.jaspersoft.com/sites/default/files/files/TestReport.txt
Thank you gert_1. Please have a look into the code.
If this doesn't work I have posted in the answer below.
@gert_1
In the code I have 2 strings LoC and H_Name. I am taking aggregate function count for C_Charge and T_Charge.
Last column I want (C_CHarge/T_Charge)%
Final result should be as
for ex- say: for all H_Name with John of LoC type X the percent of utilization is 25%
I want only one entry of all same name with similar type displaying the utilization percentage.
Again in next row same name say kelly with similar type and then percentage and so on.
There are 5 columns wherein first 2 are strings, 3rd and 4th are count and 5th is calculated based on (3rd/4th)%
Please let me know. Its kind of urgent.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.0.1.final using JasperReports Library version 6.0.0 -->
<!-- 2015-02-18T17:42:21 -->
<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="Test_Report" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d0e6ee29-e376-474e-b0b1-e510b1b98d66">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Domain JRS"/>
<parameter name="LoggedInUser" class="com.jaspersoft.jasperserver.api.metadata.user.domain.User" isForPrompting="false"/>
<parameter name="LoggedInUsername" class="java.lang.String" isForPrompting="false"/>
<queryString language="domain">
<![CDATA[<query>
<queryFields>
<queryField id="LoC"/>
<queryField id="H_Name"/>
<queryField id="C_Charge"/>
<queryField id="T_Charge"/>
</queryFields>
</query>]]>
</queryString>
<field name="LoC" class="java.lang.String">
<fieldDescription><![CDATA[LoC]]></fieldDescription>
</field>
<field name="H_Name" class="java.lang.String">
<fieldDescription><![CDATA[H_Name]]></fieldDescription>
</field>
<field name="C_Charge" class="java.math.BigDecimal">
<fieldDescription><![CDATA[C_Charge]]></fieldDescription>
</field>
<field name="T_Charge" class="java.math.BigDecimal">
<fieldDescription><![CDATA[T_Charge]]></fieldDescription>
</field>
<variable name="C_Charge" class="java.lang.Float" calculation="Count">
<variableExpression><![CDATA[$F{C_Charge}]]></variableExpression>
</variable>
<variable name="T_Charge" class="java.lang.Float" calculation="Count">
<variableExpression><![CDATA[$F{T_Charge}]]></variableExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement x="169" y="31" width="141" height="30" uuid="f8e8d350-5e62-4cb1-88f4-4d90c0a26f0f"/>
<text><![CDATA[Test_Report]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch">
<staticText>
<reportElement x="10" y="15" width="100" height="30" uuid="3137cb54-5ceb-4610-9694-43e3350ba2ca"/>
<text><![CDATA[H_Name]]></text>
</staticText>
<staticText>
<reportElement x="120" y="15" width="100" height="30" uuid="31b82771-b233-420c-8527-4b19539c4541"/>
<text><![CDATA[LoC]]></text>
</staticText>
<staticText>
<reportElement x="230" y="20" width="100" height="30" uuid="1bb775a5-0687-4cd3-8866-66c49241fcec"/>
<text><![CDATA[C_Charge]]></text>
</staticText>
<staticText>
<reportElement x="340" y="20" width="100" height="30" uuid="daa3b268-25bb-4432-8520-435ccbcb8b85"/>
<text><![CDATA[T_Charge]]></text>
</staticText>
<staticText>
<reportElement x="450" y="20" width="100" height="30" uuid="96b292e7-ea61-46e2-ac3d-4a01384d619a"/>
<text><![CDATA[Percent]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<textField>
<reportElement x="10" y="20" width="100" height="30" uuid="f2e609df-32ac-4c90-a4b0-839c96941834"/>
<textFieldExpression><![CDATA[$F{H_Name}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="120" y="20" width="100" height="30" uuid="02e3487b-a9c6-4abe-9158-5b1cf01ca886"/>
<textFieldExpression><![CDATA[$F{LoC}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="230" y="20" width="100" height="30" uuid="0273b625-0046-482e-b7bd-17d4a4454d49"/>
<textFieldExpression><![CDATA[$V{C_Charge}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="20" width="100" height="30" uuid="c08b805e-8c0d-440a-8e9e-00e9516f9724"/>
<textFieldExpression><![CDATA[$V{T_Charge}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.##%">
<reportElement x="450" y="20" width="100" height="30" uuid="3ae46dc6-e5df-491c-8063-ddf600f0bb92"/>
<textFieldExpression><![CDATA[$V{C_Charge}/$V{T_Charge}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="12" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.0.1.final using JasperReports Library version 6.0.0 -->
<!-- 2015-02-18T17:42:21 -->
<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="Test_Report" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="d0e6ee29-e376-474e-b0b1-e510b1b98d66">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Domain JRS"/>
<parameter name="LoggedInUser" class="com.jaspersoft.jasperserver.api.metadata.user.domain.User" isForPrompting="false"/>
<parameter name="LoggedInUsername" class="java.lang.String" isForPrompting="false"/>
<queryString language="domain">
<![CDATA[<query>
<queryFields>
<queryField id="LoC"/>
<queryField id="H_Name"/>
<queryField id="C_Charge"/>
<queryField id="T_Charge"/>
</queryFields>
</query>]]>
</queryString>
<field name="LoC" class="java.lang.String">
<fieldDescription><![CDATA[LoC]]></fieldDescription>
</field>
<field name="H_Name" class="java.lang.String">
<fieldDescription><![CDATA[H_Name]]></fieldDescription>
</field>
<field name="C_Charge" class="java.math.BigDecimal">
<fieldDescription><![CDATA[C_Charge]]></fieldDescription>
</field>
<field name="T_Charge" class="java.math.BigDecimal">
<fieldDescription><![CDATA[T_Charge]]></fieldDescription>
</field>
<variable name="C_Charge" class="java.lang.Float" calculation="Count">
<variableExpression><![CDATA[$F{C_Charge}]]></variableExpression>
</variable>
<variable name="T_Charge" class="java.lang.Float" calculation="Count">
<variableExpression><![CDATA[$F{T_Charge}]]></variableExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement x="169" y="31" width="141" height="30" uuid="f8e8d350-5e62-4cb1-88f4-4d90c0a26f0f"/>
<text><![CDATA[Test_Report]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch">
<staticText>
<reportElement x="10" y="15" width="100" height="30" uuid="3137cb54-5ceb-4610-9694-43e3350ba2ca"/>
<text><![CDATA[H_Name]]></text>
</staticText>
<staticText>
<reportElement x="120" y="15" width="100" height="30" uuid="31b82771-b233-420c-8527-4b19539c4541"/>
<text><![CDATA[LoC]]></text>
</staticText>
<staticText>
<reportElement x="230" y="20" width="100" height="30" uuid="1bb775a5-0687-4cd3-8866-66c49241fcec"/>
<text><![CDATA[C_Charge]]></text>
</staticText>
<staticText>
<reportElement x="340" y="20" width="100" height="30" uuid="daa3b268-25bb-4432-8520-435ccbcb8b85"/>
<text><![CDATA[T_Charge]]></text>
</staticText>
<staticText>
<reportElement x="450" y="20" width="100" height="30" uuid="96b292e7-ea61-46e2-ac3d-4a01384d619a"/>
<text><![CDATA[Percent]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<textField>
<reportElement x="10" y="20" width="100" height="30" uuid="f2e609df-32ac-4c90-a4b0-839c96941834"/>
<textFieldExpression><![CDATA[$F{H_Name}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="120" y="20" width="100" height="30" uuid="02e3487b-a9c6-4abe-9158-5b1cf01ca886"/>
<textFieldExpression><![CDATA[$F{LoC}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="230" y="20" width="100" height="30" uuid="0273b625-0046-482e-b7bd-17d4a4454d49"/>
<textFieldExpression><![CDATA[$V{C_Charge}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="20" width="100" height="30" uuid="c08b805e-8c0d-440a-8e9e-00e9516f9724"/>
<textFieldExpression><![CDATA[$V{T_Charge}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.##%">
<reportElement x="450" y="20" width="100" height="30" uuid="3ae46dc6-e5df-491c-8063-ddf600f0bb92"/>
<textFieldExpression><![CDATA[$V{C_Charge}/$V{T_Charge}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="12" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
/sites/default/files/files/TestReport.txt
This is the link for the code.
We will need more info to help you out, can you post your jrxml file? If not we are just guessing.
Chnaces are that your report is generating 10000 of pages because is what the design tells it to do. Remember that the detail band will be generated for every record regardless if is empty. You can also disable (delete the detail band) or add the print when expression to the band itself.
Can you please tell me how do I upload the file. I am not getting any option for that. Sorry I am new to the community.
Thank you marinol this is the link for the code. Please let me know
http://community.jaspersoft.com/sites/default/files/files/TestReport.txt
In the code I have 2 strings LoC and H_Name. I am taking aggregate function count for C_Charge and T_Charge.
Last column I want (C_CHarge/T_Charge)%
Final result should be as
for ex- say: for all H_Name with John of LoC type X the percent of utilization is 25%
I want only one entry of all same name with similar type displaying the utilization percentage.
Again in next row same name say kelly with similar type and then percentage and so on.
There are 5 columns wherein first 2 are strings, 3rd and 4th are count and 5th is calculated based on (3rd/4th)%
Please let me know. Its kind of urgent.