Jump to content
Changes to the Jaspersoft community edition download ×

hishamkmr

Members
  • Posts

    46
  • Joined

  • Last visited

Community Answers

  1. hishamkmr's post in Grouping the report column as shown in attached image was marked as the answer   
    I am assuming those abc and abc2 are null for other groups.
    for eg:
    I have a table TEST with columns
    GROUP1,SUB,DATA1,DATA2
    VALUES in the table
    Name1,   null , one, two
    NAME2, null, one,two
    NAME3,ab,one,two
    NAME3,ac,one,two
    my query for ireport will be
    select group1,sub,data1,data2from testgroup by group1,sub,data1,data2order by group1 Then create group band in ireport with group1place group1,data1,data2 in group headerbandand give <printWhenExpression> for data1 and data2 as show only when sub is null then place sub,data1,data2 in detail band of the reportand give <printWhenExpression> for sub,data1, and data2 as show only when sub is not null find the below xml code<?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="test2" 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><![CDATA[select group1,sub,data1,data2from testgroup by group1,sub,data1,data2order by group1]]></queryString><field name="GROUP1" class="java.lang.String"/><field name="SUB" class="java.lang.String"/><field name="DATA1" class="java.lang.String"/><field name="DATA2" class="java.lang.String"/><group name="GROUP1"><groupExpression><![CDATA[$F{GROUP1}]]></groupExpression><groupHeader><band height="20"><textField><reportElement x="0" y="0" width="100" height="20"/><textElement/><textFieldExpression class="java.lang.String"><![CDATA[$F{GROUP1}]]></textFieldExpression></textField><textField><reportElement x="100" y="0" width="84" height="20"><printWhenExpression><![CDATA[new Boolean($F{SUB}==null)]]></printWhenExpression></reportElement><textElement/><textFieldExpression class="java.lang.String"><![CDATA[$F{DATA1}]]></textFieldExpression></textField><textField><reportElement x="184" y="0" width="100" height="20"><printWhenExpression><![CDATA[new Boolean($F{SUB}==null)]]></printWhenExpression></reportElement><textElement/><textFieldExpression class="java.lang.String"><![CDATA[$F{DATA2}]]></textFieldExpression></textField></band></groupHeader></group><background><band splitType="Stretch"/></background><title><band height="79" splitType="Stretch"/></title><detail><band height="20" splitType="Stretch"><textField><reportElement x="100" y="0" width="100" height="20"><printWhenExpression><![CDATA[new Boolean($F{SUB}!=null)]]></printWhenExpression></reportElement><textElement/><textFieldExpression class="java.lang.String"><![CDATA[$F{SUB}]]></textFieldExpression></textField><textField><reportElement x="200" y="0" width="100" height="20"><printWhenExpression><![CDATA[new Boolean($F{SUB}!=null)]]></printWhenExpression></reportElement><textElement/><textFieldExpression class="java.lang.String"><![CDATA[$F{DATA1}]]></textFieldExpression></textField><textField><reportElement x="300" y="0" width="100" height="20"><printWhenExpression><![CDATA[new Boolean($F{SUB}!=null)]]></printWhenExpression></reportElement><textElement/><textFieldExpression class="java.lang.String"><![CDATA[$F{DATA2}]]></textFieldExpression></textField></band></detail><summary><band height="29" splitType="Stretch"/></summary></jasperReport>-----------------------------------------------------Run the report you will get the output as given in ur question. also find the jrxml file attached with this.  let me know whether this helped.  
  2. hishamkmr's post in creating your first report from ireport ultimate guide creates an empty document was marked as the answer   
    Dear Marius
    I just downloaded ur jasper file. In that design template is empty
    Go to the report inspector and drill the "Field" from there you can see the fields got using your query in i-report
    drag and drop the needed fields in to the detail band of ireport and run the report.it will show the data..
     
    hope it help..let me know the result
×
×
  • Create New...