Wednesday 18 July 2018

Composite element example in Jaspersoft Reports

Hi,

Composite element allow to create a new element in the palette starting from one or more basic elements, and reuse them whenever you want in any report.

As shown in below image you can take basic elements like Text Field and Ellipse from palette. Right click on the selection of these two to create composite element and give required details(name, description and an icon with position to keep it on the palette).

(NOTE : Click on image to get the best view of content placed)

(NOTE : Click on image to get the best view of content placed)


Composite element allows below actions(Edit, Export and Import)  in studio.

This way you can create a custom element in palette and use in a project if you have to re-use the code/design. i.e., this will give the flexibility of re-usability of design across reports. kinda a components based templates.

References: https://community.jaspersoft.com/wiki/composite-element

- Sadakar Pochampalli


JRXML:(Supports in 6.4.2 professional or later).
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.2.final using JasperReports Library version 6.4.1  -->
<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="CompositeElementExample" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="ab08f6fe-e37c-42b7-8721-c46a41536ae3">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="133" splitType="Stretch">
<textField>
<reportElement x="138" y="40" width="100" height="30" uuid="0035655a-100c-4dac-a8b8-a91e6a916b0d"/>
<textFieldExpression><![CDATA["Text Field"]]></textFieldExpression>
</textField>
<ellipse>
<reportElement x="240" y="10" width="100" height="79" uuid="3207973b-e49e-43cc-9611-6ed03ce5b3cd"/>
</ellipse>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch"/>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>

Tuesday 17 July 2018

How is your palette looking in Jaspersoft Studio ?

Are you tired of easily finding the components of palette to design reports in jaspersoft studio?

You can use the combination of "large icons" with "Layout" as "Columns" instead of routine look and feel. As shown in below image, right click on any empty space in the window, let's say in "Basic Elements" section, right click anywhere and select "Use Large Icons" with  the combination of "Layout" as "Columns" and have an easy access to the components when you write some complex reports. !  



Cheers! Small things sometimes saves a bit time. 

- Sadakar Pochampalli 

Tip : Relatively increase the height of the less text contained field with the maximum text contained field in jaspersoft reports

Hi, 

Expected output should be as shown in below image. 

Solution: (Read the image properties - outlined red in color)


Related article can be found here : 
http://jasper-bi-suite.blogspot.com/2016/03/tip-detail-overflow-vs-streach-with.html

JRXML(Supports in 6.4.2 professional version)

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.2.final using JasperReports Library version 6.4.1  -->
<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="Frames" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="5ac4213c-a87a-46d0-bfd2-bfff11545590">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<property name="ireport.callouts" value="callouts.1.fg=0,0,0\ncallouts.1.text=sadakar 7/17/18 1\:20 AM\r\n\r\nAppearance section\r\n------------------------------\r\nPosition Type \= Float\r\nStretch Type \= Relative to Tallest Object\r\n\r\nText field section\r\n--------------------------\r\nCheck Streatch with Overflow\r\n\r\nOther references\r\nhttps\://community.jaspersoft.com/blog/tip-detail-overflow-vs-stretch-overflow-jasper-reports-when-use-how-avoid-repetaitonimages-or\ncallouts.1.bounds=50,60,360,250\ncallouts.1.bg=255,255,0\n"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<summary>
<band height="30" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="100" height="30" uuid="eb1d8f3e-313a-469f-a4a9-6585d7c3388a"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textFieldExpression><![CDATA["Hi"]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="100" y="0" width="100" height="30" uuid="8bc5b479-d3d7-4f30-b77a-8d69f2da10e0"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textFieldExpression><![CDATA["Yakuza Solo hopes his bamboo bicycle will make the world aware of his home state of Nagaland."]]></textFieldExpression>
</textField>
</band>
</summary>
</jasperReport>