Jump to content
Changes to the Jaspersoft community edition download ×

XML as datasource - search samples


2004 IR Help

Recommended Posts

By: Slobodan Kasterovic - kaster

XML as datasource - search samples

2005-04-14 01:55

Hi all,

 

I have XML connection and one Field defined and wont to display values of this field in a details pane.

 

I become though corect count of rows but always the same values.

 

Hier my report and XML-DataSource (SelectExpression is "/bericht/aufwandsbuchungen/aufwandsbuchung"):

 

REPORT:

<?xml version="1.0" encoding="UTF-8" ?>

<!-- Created with iReport - A designer for JasperReports -->

<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport

name="xnb"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="595"

pageHeight="842"

columnWidth="535"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="AllSectionsNoDetail"

isTitleNewPage="false"

isSummaryNewPage="false">

<property name="ireport.scriptlethandling" value="2" />

<import value="java.util.*" />

<import value="net.sf.jasperreports.engine.*" />

<import value="net.sf.jasperreports.engine.data.*" />

<field name="AUFWAND_DER_BUCHUNG" class="java.lang.Integer">

<fieldDescription><![CDATA[/bericht/aufwandsbuchungen/aufwandsbuchung]]></fieldDescription>

</field>

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="50" isSplitAllowed="true" >

</band>

</title>

<pageHeader>

<band height="50" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="30" isSplitAllowed="true" >

<staticText>

<reportElement

mode="Opaque"

x="468"

y="14"

width="65"

height="13"

forecolor="#000000"

backcolor="#FFFFFF"

key="staticText-4"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#FFFFFF" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Center" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<text><![CDATA[Hours]]></text>

</staticText>

</band>

</columnHeader>

<detail>

<band height="24" isSplitAllowed="true" >

<rectangle radius="0" >

<reportElement

mode="Opaque"

x="0"

y="0"

width="535"

height="24"

forecolor="#000000"

backcolor="#CCCCCC"

key="rectangle-1"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<graphicElement stretchType="NoStretch" pen="Thin" fill="Solid" />

</rectangle>

<staticText>

<reportElement

mode="Transparent"

x="390"

y="5"

width="71"

height="15"

forecolor="#000000"

backcolor="#FFFFFF"

key="staticText-2"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#FFFFFF" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="12" isBold="true" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<text><![CDATA[item:]]></text>

</staticText>

<textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Column" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

mode="Opaque"

x="467"

y="5"

width="65"

height="14"

forecolor="#000000"

backcolor="#FFFFFF"

key="textField"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#FFFFFF" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Right" verticalAlignment="Top" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<textFieldExpression class="java.lang.Integer"><![CDATA[$F{AUFWAND_DER_BUCHUNG}]]></textFieldExpression>

</textField>

</band>

</detail>

<columnFooter>

<band height="23" isSplitAllowed="true" >

<staticText>

<reportElement

mode="Opaque"

x="447"

y="0"

width="88"

height="23"

forecolor="#000000"

backcolor="#FFFFFF"

key="staticText-5"

stretchType="NoStretch"

positionType="FixRelativeToTop"

isPrintRepeatedValues="true"

isRemoveLineWhenBlank="false"

isPrintInFirstWholeBand="false"

isPrintWhenDetailOverflows="false"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#FFFFFF" bottomBorder="None" bottomBorderColor="#000000"/>

<textElement textAlignment="Left" verticalAlignment="Middle" rotation="None" lineSpacing="Single">

<font fontName="Arial" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isPdfEmbedded ="false" pdfEncoding ="Cp1252" isStrikeThrough="false" />

</textElement>

<text><![CDATA[sUM:]]></text>

</staticText>

</band>

</columnFooter>

<pageFooter>

<band height="14" isSplitAllowed="true" >

</band>

</pageFooter>

<summary>

<band height="0" isSplitAllowed="true" >

</band>

</summary>

</jasperReport>

 

XML-DataSource:

 

<?xml version="1.0" encoding="ISO-8859-1"?>

<bericht>

<aufwandsbuchungen>

<aufwandsbuchung>1</aufwandsbuchung>

<aufwandsbuchung>2</aufwandsbuchung>

</aufwandsbuchungen>

</bericht>

 

How can i print both values (1 and 2) and calculate sum of them (3) ?

 

Thanks

 

Kaster

 

 

 

 

By: Slobodan Kasterovic - kaster

RE: XML as datasource - search samples

2005-04-14 05:20

In a aReport i see two rows and in webApplication just one row (each with value/s 1).

Is there otherwise identified incompatibility between iReport and JastperReports.

 

I use:

 

iReport v0.4.1 (compiler jaspereports v0.6.6)

webApplication (jasperreports v0.6.6)

 

Are somewhere samples with XMl-DataSource? (posible with subReports to)

 

Thanks

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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