Précédent   Forum des professionnels en informatique > Logiciels > Solutions d'entreprise > Business Intelligence > Jasper
Jasper Forum d'entraide sur Jasper Reports. Avant de poster --> FAQ Jasper, Tutoriels Jasper
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 06/09/2011, 09h51   #1
Invité de passage
 
Homme Alexandre
Inscription : septembre 2011
Messages : 13
Détails du profil
Informations personnelles :
Nom : Homme Alexandre

Informations forums :
Inscription : septembre 2011
Messages : 13
Points : 3
Points : 3
Par défaut Talend et iReport : Cannot cast from Double to String

Bonjour,

Je ne sais pas si je dois poster le message ici ou sur le forum Talend.

J'ai créée un rapport très simple avec iReport (v4.1.1), qui fonctionne très bien quand je l’exécute en "interactif" (ie quand je passe en preview dans iReport).
Dans le rapport, j'ai une connection à une bdd MySQL, sur laquelle je fais un filtre, et un regroupement.
J'ai sauvegardé ce fichier *.jrxml.
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?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="report_talend" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
	<property name="ireport.zoom" value="1.0"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<queryString language="SQL">
		<![CDATA[SELECT
     table_chris.`idtable_chris` AS table_chris_idtable_chris,
     table_chris.`Vendeur` AS table_chris_Vendeur,
     table_chris.`Campagne` AS table_chris_Campagne,
     table_chris.`Montant` AS table_chris_Montant,
     table_chris.`LeadNumber` AS table_chris_LeadNumber,
     table_chris.`Date` AS table_chris_Date
FROM
     `table_chris` table_chris
WHERE
     Montant IS NOT NULL
GROUP BY
     table_chris_Vendeur
ORDER BY
     table_chris.`Montant` ASC]]>
	</queryString>
	<field name="table_chris_idtable_chris" class="java.lang.Integer"/>
	<field name="table_chris_Vendeur" class="java.lang.String"/>
	<field name="table_chris_Campagne" class="java.lang.String"/>
	<field name="table_chris_Montant" class="java.lang.Double"/>
	<field name="table_chris_LeadNumber" class="java.lang.String"/>
	<field name="table_chris_Date" class="java.sql.Date"/>
	<background>
		<band splitType="Stretch"/>
	</background>
	<title>
		<band height="79" splitType="Stretch"/>
	</title>
	<pageHeader>
		<band height="35" splitType="Stretch"/>
	</pageHeader>
	<columnHeader>
		<band height="22" splitType="Stretch">
			<staticText>
				<reportElement x="64" y="2" width="100" height="20"/>
				<textElement/>
				<text><![CDATA[table_chris_Vendeur]]></text>
			</staticText>
			<staticText>
				<reportElement x="234" y="2" width="100" height="20"/>
				<textElement/>
				<text><![CDATA[table_chris_Montant]]></text>
			</staticText>
		</band>
	</columnHeader>
	<detail>
		<band height="21" splitType="Stretch">
			<textField>
				<reportElement x="64" y="1" width="100" height="20"/>
				<textElement/>
				<textFieldExpression><![CDATA[$F{table_chris_Vendeur}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement x="234" y="1" width="100" height="20"/>
				<textElement/>
				<textFieldExpression><![CDATA[$F{table_chris_Montant}]]></textFieldExpression>
			</textField>
		</band>
	</detail>
	<columnFooter>
		<band height="45" splitType="Stretch"/>
	</columnFooter>
	<pageFooter>
		<band height="54" splitType="Stretch"/>
	</pageFooter>
	<summary>
		<band height="42" splitType="Stretch"/>
	</summary>
</jasperReport>
Voilà le log iReport
Code :
1
2
3
4
5
6
7
8
 *Compiling to file... C:\Users\apoisson\report_talend.jasper
Compilation running time: 1*749! 
 *Filling report...
 *Locale: français (France)
 *Time zone: Default
Report fill running time: 709! (pages generated: 1) 
 *Viewing with JasperReports Viewer
Export running time: 6
Ensuite j'ai ouvert TOS (v4.2.2), et j'ai créer ma connection à ma bdd, récupérer le schéma, et ajouter un lien avec un tJasperOuput.

Lorsque j'éxecute mon job, voilà le message que je vois dans la console Talend :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Exception in component tJasperOutput_1
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. Cannot cast from Double to String
                value = (java.lang.String)(((java.lang.Double)field_table_chris_Montant.getValue())); //$JR_EXPR_ID=9$
                        <-------------------------------------------------------------------------->
2. Cannot cast from Double to String
                value = (java.lang.String)(((java.lang.Double)field_table_chris_Montant.getOldValue())); //$JR_EXPR_ID=9$
                        <----------------------------------------------------------------------------->
3. Cannot cast from Double to String
                value = (java.lang.String)(((java.lang.Double)field_table_chris_Montant.getValue())); //$JR_EXPR_ID=9$
                        <-------------------------------------------------------------------------->
3 errors
	at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:191)
	at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:215)
	at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:131)
	at bi_project.cree_rapport_0_1.cree_rapport.tMysqlInput_1Process(cree_rapport.java:797)
	at bi_project.cree_rapport_0_1.cree_rapport.runJobInTOS(cree_rapport.java:1016)
	at bi_project.cree_rapport_0_1.cree_rapport.main(cree_rapport.java:890)
lorsque j'édite mes schémas dans Talend, les noms et les formats sont les mêmes, je ne comprend pas pourquoi quelqu'un (Talend ? iReport ?) cherche à faire un cast d'un double vers un string


Merci pour votre aide. Je débute à la fois sur TOS, iReport et SQL, alors cette requête n'a rien d'urgent
_Tido_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 17h23.


 
 
 
 
Partenaires

Hébergement Web