chidupud Posted October 25, 2013 Share Posted October 25, 2013 could you please give sample jrxmls for main report and subreportswe are not using ireport tool.so manually have to create jrxml. thaks in advance Link to comment Share on other sites More sharing options...
H Mendoza Posted October 25, 2013 Share Posted October 25, 2013 Hi there - Here is the main 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="sampleMainSub" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="fc655f78-6553-4b1a-9418-e98d696de57b"><property name="ireport.zoom" value="1.0"/><property name="ireport.x" value="0"/><property name="ireport.y" value="0"/><parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"><defaultValueExpression><![CDATA["C:\Users\hmendoza\Desktop\labWork\"]]></defaultValueExpression></parameter><queryString><![CDATA[sELECT department."department_id" AS department_department_id, department."department_description" AS department_department_descriptionFROM "public"."department" department]]></queryString><field name="department_department_id" class="java.lang.Integer"/><field name="department_department_description" class="java.lang.String"/><group name="department"><groupExpression><![CDATA[$F{department_department_description}]]></groupExpression><groupHeader><band height="33"><textField><reportElement uuid="7afed144-ae54-4d66-abc5-dce17eb40a83" x="0" y="0" width="555" height="33"/><textElement><font size="14" isBold="true"/></textElement><textFieldExpression><![CDATA[$F{department_department_description} + ": " + $F{department_department_id}]]></textFieldExpression></textField></band></groupHeader></group><title><band height="32" splitType="Stretch"><textField><reportElement uuid="44f21734-53a3-491a-b7b4-e409fa2e3cbd" x="0" y="0" width="555" height="32"/><textElement><font size="24" isBold="true"/></textElement><textFieldExpression><![CDATA["Main Report"]]></textFieldExpression></textField></band></title><columnHeader><band height="20" splitType="Stretch"/></columnHeader><detail><band height="100" splitType="Stretch"><subreport><reportElement uuid="478ca3c1-6496-46fd-85d7-8b92746c7b92" x="0" y="0" width="555" height="100"/><subreportParameter name="department_ID"><subreportParameterExpression><![CDATA[$F{department_department_id}]]></subreportParameterExpression></subreportParameter><connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression><subreportExpression><![CDATA["C:\Users\hmendoza\Desktop\labWork\subReport.jasper"]]></subreportExpression></subreport></band></detail><pageFooter><band height="54" splitType="Stretch"/></pageFooter></jasperReport> ... And here is the subreport: <?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="subReport" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="1896faa6-afcb-4c1c-9e4c-7820cc21c791"><property name="ireport.zoom" value="1.0"/><property name="ireport.x" value="0"/><property name="ireport.y" value="0"/><parameter name="department_ID" class="java.lang.Integer"><defaultValueExpression><![CDATA[1]]></defaultValueExpression></parameter><queryString><![CDATA[sELECT employee."employee_id" AS employee_employee_id, employee."full_name" AS employee_full_name, employee."first_name" AS employee_first_name, employee."last_name" AS employee_last_name, employee."position_id" AS employee_position_id, employee."position_title" AS employee_position_title, employee."store_id" AS employee_store_id, employee."department_id" AS employee_department_id, employee."birth_date" AS employee_birth_date, employee."hire_date" AS employee_hire_date, employee."end_date" AS employee_end_date, employee."salary" AS employee_salary, employee."supervisor_id" AS employee_supervisor_id, employee."education_level" AS employee_education_level, employee."marital_status" AS employee_marital_status, employee."gender" AS employee_gender, employee."management_role" AS employee_management_roleFROM "public"."employee" employeeWHERE employee.department_id = $P{department_ID}]]></queryString><field name="employee_employee_id" class="java.lang.Integer"/><field name="employee_full_name" class="java.lang.String"/><field name="employee_first_name" class="java.lang.String"/><field name="employee_last_name" class="java.lang.String"/><field name="employee_position_id" class="java.lang.Integer"/><field name="employee_position_title" class="java.lang.String"/><field name="employee_store_id" class="java.lang.Integer"/><field name="employee_department_id" class="java.lang.Integer"/><field name="employee_birth_date" class="java.sql.Date"/><field name="employee_hire_date" class="java.sql.Timestamp"/><field name="employee_end_date" class="java.sql.Timestamp"/><field name="employee_salary" class="java.math.BigDecimal"/><field name="employee_supervisor_id" class="java.lang.Integer"/><field name="employee_education_level" class="java.lang.String"/><field name="employee_marital_status" class="java.lang.String"/><field name="employee_gender" class="java.lang.String"/><field name="employee_management_role" class="java.lang.String"/><columnHeader><band height="20" splitType="Stretch"><staticText><reportElement uuid="9b677ff2-0655-43a0-bc6e-037573327a80" x="0" y="0" width="111" height="20"/><textElement><font isBold="true" isUnderline="true"/></textElement><text><![CDATA[First Name]]></text></staticText><staticText><reportElement uuid="823a666b-17b7-44b7-a6d3-4c429fa6e0a2" x="111" y="0" width="111" height="20"/><textElement><font isBold="true" isUnderline="true"/></textElement><text><![CDATA[Last Name]]></text></staticText><staticText><reportElement uuid="1e469b57-c467-4457-939b-f396f979d426" x="222" y="0" width="81" height="20"/><textElement><font isBold="true" isUnderline="true"/></textElement><text><![CDATA[salary]]></text></staticText><staticText><reportElement uuid="8284a3fe-db19-4ba1-a2c9-0904a17b1f50" x="303" y="0" width="106" height="20"/><textElement><font isBold="true" isUnderline="true"/></textElement><text><![CDATA[Marital Status]]></text></staticText><staticText><reportElement uuid="11e18904-9c16-497e-9ab8-3ebab4c1995d" x="409" y="0" width="146" height="20"/><textElement><font isBold="true" isUnderline="true"/></textElement><text><![CDATA[Role]]></text></staticText></band></columnHeader><detail><band height="20" splitType="Stretch"><textField><reportElement uuid="c30abe7b-ad72-4b7d-9fe1-4facef333013" x="0" y="0" width="111" height="20"/><textElement verticalAlignment="Middle"/><textFieldExpression><![CDATA[$F{employee_first_name}]]></textFieldExpression></textField><textField><reportElement uuid="9da4daf3-0ba5-4609-ba86-955a1f4cc862" x="111" y="0" width="111" height="20"/><textElement verticalAlignment="Middle"/><textFieldExpression><![CDATA[$F{employee_last_name}]]></textFieldExpression></textField><textField pattern="¤ #,##0"><reportElement uuid="aff8ecd9-7c2a-4580-ad83-ea8d3405005f" x="222" y="0" width="81" height="20"/><textElement verticalAlignment="Middle"/><textFieldExpression><![CDATA[$F{employee_salary}]]></textFieldExpression></textField><textField><reportElement uuid="38fb7ccb-e928-4876-9194-d9a3152e1f59" x="303" y="0" width="106" height="20"/><textElement verticalAlignment="Middle"/><textFieldExpression><![CDATA[$F{employee_marital_status}]]></textFieldExpression></textField><textField><reportElement uuid="28ced81a-61ff-4db7-98f8-c5d13b2da8e7" x="409" y="0" width="146" height="20"/><textElement verticalAlignment="Middle"/><textFieldExpression><![CDATA[$F{employee_management_role}]]></textFieldExpression></textField></band></detail></jasperReport> Good luck with your work! 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