2005 IR Help Posted September 2, 2006 Share Posted September 2, 2006 By: AlperULUSOY - taramakalemi Subreport + TableModel 2005-07-02 09:06 Hi, I can use tablemodel datasource, but i couldnt make it with two reports each consist of tablemodel datasource. JasperPrint jasperPrint = JasperManager.fillReport("Report.jasper", parameters, new JRTableModelDataSource(mytablemodel)); so i can print one but by the master.. Please help. Alper By: noeliak - noeliak RE: Subreport + TableModel 2005-07-08 09:56 hello, I have the same problem, except that I'm (at least)one step before. in iReport, what did you write in the textfield to get the correct field of the JRDataSource? (if the name of the column is not always the same and the same with the data type). Thank you, Noelia By: noeliak - noeliak RE: Subreport + TableModel 2005-07-08 11:29 class JasperManager is seems to be deprecated By: AlperULUSOY - taramakalemi RE: Subreport + TableModel 2005-07-04 01:55 I think, I solved my problem with the code and subreporting docs. Map parameters = new HashMap(); parameters.put("pathsubrep", "Detailxx.jasper"); parameters.put("datasource",new JRTableModelDataSource(detailmodel)); JasperPrint jasperPrint = JasperManager.fillReport("Masterreport.jasper", parameters, new JRTableModelDataSource(mastermodel)); Then, i got a master-detail report. But i should still have to filter the detail report... ????but how? By: AlperULUSOY - taramakalemi RE: Subreport + TableModel 2005-07-12 00:45 noeliak, for dinamic columnnames i think u should name columns in report like COLUMN_1, COLUMN_2... i mean u can give by index numbers not by using directly names. i've managed to report master-detail by jrtablemodel ds.. if u want i can give u the code. Thanks, Alper By: AlperULUSOY - taramakalemi RE: Subreport + TableModel 2005-07-12 00:47 I have still problems with my report's view.. By: noeliak - noeliak RE: Subreport + TableModel 2005-07-12 06:57 Alper, thank you for the advise. I'm about to change my code to try it. If you want, you can send me the code to noeliak@yahoo.com in iReport, what do you write in the textField? I'm trying $P{DS}.getValueAt(row,col) and it doesn't work. Thank you very much, Noelia By: AlperULUSOY - taramakalemi RE: Subreport + TableModel 2005-07-12 07:43 Hi Noelia, First, in my masterreport i put my masterdatasource's fields normally.. then in detail band put a subreport tool. Double click it, in subreport page choose "use datasource expression" in connections combobox. change the name "mydatasource" to a name u want and put a parameter with the same name to the actual report(master). By this way u 're passing a ds to a subreport. Anyway, in the subreport(other) page give full path of ur subreport like "E:\datasourcereportxx.jasper" and add parameter which you've just add your ds name (like mydatasource). Create the subreport using its field names. the code for ur java application is same i wrote in my previous comments.. and one tutorial tells one way to similar of mine : http://geocities.yahoo.com.br/robertofurutani/java/Tutorial_JasperReports/ Good Luck! Alper By: AlperULUSOY - taramakalemi RE: Subreport + TableModel 2005-07-12 07:48 However, im my textfields i use just column names like $F{NAME}. Link to comment Share on other sites More sharing options...
manoj0523 Posted August 1, 2011 Share Posted August 1, 2011 i have developed an application in netbeans(java) and 've installed Jasper report and ireport in netbeans ,Now iam passing resultset as report parameter and i have designed Jasper report , so the result is coming fine but, if i need actual output from a jtable, what i want to do?I used the following code to send TableModel as Datasource to jasper report, but the report is coming blank, but it has 12 pages...PLease go thru the following code and help me out of it.. JAVA CODE: JasperDesign jasperDesign = JRXmlLoader.load (path+"/src/gwdashboard/Reports/"+rptname); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); JRTableModelDataSource tblm = new JRTableModelDataSource(tablemodel); print = JasperFillManager.fillReport(jasperReport, Param, tblm); XML CODE IN JASPER 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="null" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" 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"/> <style name="Title" fontName="Times New Roman" fontSize="50" isBold="true" pdfFontName="Times-Bold"/> <style name="SubTitle" forecolor="#736343" fontName="Arial" fontSize="18"/> <style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/> <style name="Detail" fontName="Arial" fontSize="12"/> <style name="Row" mode="Transparent"> <conditionalStyle> <conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression> <style backcolor="#E6DAC3"/> </conditionalStyle> </style> <parameter name="rptdir" class="java.lang.String"/> <parameter name="xcmpy" class="java.lang.String"/> <queryString> <![CDATA[$P{Param}]]> </queryString> <background> <band/> </background> <title> <band height="78"> <staticText> <reportElement style="SubTitle" x="276" y="24" width="196" height="22"/> <textElement> <font fontName="Times New Roman" pdfFontName="Times-Roman"/> </textElement> <text><![CDATA[Purchase Analysis Report]]></text> </staticText> <textField> <reportElement x="533" y="4" width="269" height="42"/> <textElement textAlignment="Right"> <font fontName="Arial Narrow" size="36"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$P{xcmpy}]]></textFieldExpression> </textField> <image> <reportElement x="2" y="4" width="164" height="62"/> <imageExpression class="java.lang.String"><![CDATA[$P{rptdir}]]></imageExpression> </image> </band> </title> <pageHeader> <band/> </pageHeader> <columnHeader> <band height="16"> <line> <reportElement positionType="FixRelativeToBottom" x="0" y="15" width="802" height="1"/> <graphicElement> <pen lineWidth="0.5" lineColor="#999999"/> </graphicElement> </line> </band> </columnHeader> <detail> <band height="22"> <frame> <reportElement style="Row" mode="Opaque" x="0" y="0" width="802" height="22"/> </frame> </band> </detail> <columnFooter> <band height="6"> <line> <reportElement positionType="FixRelativeToBottom" x="0" y="3" width="802" height="1"/> <graphicElement> <pen lineWidth="0.5" lineColor="#999999"/> </graphicElement> </line> </band> </columnFooter> <pageFooter> <band height="25"> <frame> <reportElement mode="Opaque" x="-21" y="1" width="843" height="24" forecolor="#D0B48E" backcolor="#F2EBDF"/> <textField evaluationTime="Report"> <reportElement style="Column header" x="783" y="1" width="40" height="20" forecolor="#736343"/> <textElement verticalAlignment="Middle"> <font size="10" isBold="false"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression> </textField> <textField> <reportElement style="Column header" x="703" y="1" width="80" height="20" forecolor="#736343"/> <textElement textAlignment="Right" verticalAlignment="Middle"> <font size="10" isBold="false"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression> </textField> <textField pattern="EEEEE dd MMMMM yyyy"> <reportElement style="Column header" x="22" y="1" width="197" height="20" forecolor="#736343"/> <textElement verticalAlignment="Middle"> <font size="10" isBold="false"/> </textElement> <textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression> </textField> </frame> </band> </pageFooter> <summary> <band/> </summary></jasperReport>_______________PLease help me out sir.. i need the TableModel as DataSource and the report must contain the datas as in the table without designing the jasper report.(if iam designing i.e if i fill the fields in report , it is coming fine, but i need the output without designing..)Pleas Reply ASAP...Thanks in AdvanceManoj Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now