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

ernst_2

Members
  • Posts

    31
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Posts posted by ernst_2

  1. Found it!

    <parameter name="P_SUB_DATASOURCE" class="com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JdbcReportDataSource" isForPrompting="false">    <defaultValueExpression><![CDATA[com.jaspersoft.jasperserver.api.engine.jasperreports.util.RepositoryUtil.getThreadRepositoryContext().getRepository().getResource(null,"/<path to data source>/")]]></defaultValueExpression></parameter>[/code]
    <parameter name="P_SUB_CONNECTION" class="java.sql.Connection" isForPrompting="false">    <defaultValueExpression><![CDATA[java.sql.DriverManager.getConnection($P{P_SUB_DATASOURCE}.getConnectionUrl(),$P{P_SUB_DATASOURCE}.getUsername(),$P{P_SUB_DATASOURCE}.getPassword())]]></defaultValueExpression></parameter> [/code]
    <subreport>    <reportElement mode="Opaque" x="555" y="0" width="5" height="20"/>    <subreportParameter name="P_B">        <subreportParameterExpression><![CDATA[$F{user}]]></subreportParameterExpression>    </subreportParameter>    <connectionExpression><![CDATA[$P{P_SUB_CONNECTION}]]></connectionExpression>    <returnValue subreportVariable="V_M" toVariable="V_M"/>    <subreportExpression><![CDATA["repo:0001_Subreport.jrxml"]]></subreportExpression></subreport>[/code]
    <textField>    <reportElement x="555" y="10" width="5" height="20"/>    <textElement verticalAlignment="Middle"/>    <textFieldExpression><![CDATA[""; $P{P_SUB_CONNECTION}.close()]]></textFieldExpression></textField>[/code]

     

  2. Hi,

    my subreport connects successfully to a different database, by the description of ntatlock.

    Like:

    <subreport>    <reportElement mode="Opaque" x="555" y="0" width="5" height="20"/>    <subreportParameter name="P_B">        <subreportParameterExpression><![CDATA[$F{username}]]></subreportParameterExpression>    </subreportParameter>    <connectionExpression><![CDATA[java.sql.DriverManager.getConnection($P{P_SUB_DATASOURCE}.getConnectionUrl(),$P{P_SUB_DATASOURCE}.getUsername(),$P{P_SUB_DATASOURCE}.getPassword())]]></connectionExpression>    <returnValue subreportVariable="V_M" toVariable="V_M"/>    <subreportExpression><![CDATA["repo:0001_Subreport.jrxml"]]></subreportExpression></subreport>[/code]

    But the connection is not closing. So what can I do, to close the connection?

  3. Hi infrocio,

    to run iReport your Java JDK-Version must be below 1.8.

    Or maybe it helps to set the JDK-Home-Path in the iReport-Config "<path>iReport-5.6.0etcireport.conf"-File,
    like jdkhome="C:Program Files (x86)Javajdk1.7.0_75".

  4.  

    It's magic :D

    No, it's very simple.

    You only have to pass your field into the expression of a variable and use the sum calculation type.

    SQL:

    SELECT 0.5344 AS SEMUNION ALLSELECT 508.564UNION ALLSELECT 508.495899999999UNION ALLSELECT 69.8347[/code]

    Variable:

    name: SUM_SEM

    class: java.math.BigDecimal

    calculation: Sum

    reset type: report

    increment type: none

    variable expression: $F{sem}

    TextField:

    expression: $V{SUM_SEM}

    pattern: #,##0.00

  5. Hi sara.machado,

    I am not sure why the pattern is not working for you.

    This is my test file and it seems to work correctly:

    <?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="report2" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isFloatColumnFooter="true" uuid="7d1d2338-32cf-402d-bcde-e20af78120ae">    <property name="ireport.zoom" value="1.0"/>    <property name="ireport.x" value="0"/>    <property name="ireport.y" value="0"/>    <queryString>        <![CDATA[sELECT 0.5344 AS SEMUNION ALLSELECT 508.564UNION ALLSELECT 508.495899999999UNION ALLSELECT 69.8347]]>    </queryString>    <field name="sem" class="java.math.BigDecimal"/>    <variable name="SUM_SEM" class="java.math.BigDecimal" calculation="Sum">        <variableExpression><![CDATA[$F{sem}]]></variableExpression>    </variable>    <columnHeader>        <band height="20" splitType="Stretch">            <staticText>                <reportElement x="0" y="0" width="100" height="20" uuid="470afba4-c01c-46ef-ac75-b960c8f55bd0"/>                <text><![CDATA[sem]]></text>            </staticText>        </band>    </columnHeader>    <detail>        <band height="20" splitType="Stretch">            <textField pattern="#,##0.00">                <reportElement x="0" y="0" width="100" height="20" uuid="eb7dd5f0-922f-4b4c-8c32-93bbb01571dc"/>                <textFieldExpression><![CDATA[$F{sem}]]></textFieldExpression>            </textField>        </band>    </detail>    <columnFooter>        <band height="20" splitType="Stretch">            <textField pattern="#,##0.00">                <reportElement x="0" y="0" width="100" height="20" uuid="f7409b2d-0a68-49e2-a786-f4cb1761c2e0"/>                <textElement>                    <font isBold="true"/>                </textElement>                <textFieldExpression><![CDATA[$V{SUM_SEM}]]></textFieldExpression>            </textField>        </band>    </columnFooter></jasperReport>[/code]

     

×
×
  • Create New...