Jump to content
Changes to the Jaspersoft community edition download ×

sabmoonie

Members
  • Posts

    12
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by sabmoonie

  1. Good day! I've been using Jaspersoft paired with Java beans for my reports and everything is going well. It was only when I checked the logs, which can be viewed by the client, that I noticed that there is something wrong. In the code below, the highlighted line, it checks if there is an SQL connection. Since I don't use SQL it returns a warning message: JRJdbcQueryExecuter - The supplied java.sql.Connection object is null. How can the SQL connection validation be prevented?
  2. Hi! I am using Jaspersoft Studio 6.1 and I am wondering why an image shown in PDF does not follow the set image dimension on Jaspersoft. Example is: original image= 300x300, JasperSoft Image=100x100 and image shown in PDF=135x135. All of these are in pixel. Thanks for those who would clarify this and could give suggestions on how to solve this issue.
  3. I was able to kinda fix this problem but not by using Jaspersoft. As I've read on other posts, it was said that this method is really currently not working on Jaspersoft. What I did on Eclipse was I created an object to hold the necessary data including the computation of Person's age.
  4. Changed Status from Resolved to Feedback Requested I've tried this on 6.0.3 also and it also does not work in there.
  5. Hi! When would the next version be released? :c
  6. Hi all! I am trying to get the difference between two DateTime objects for me to get a Person's age. I tried using YEARS() but then I encounter this problem. . The method YEARS(DateTime, DateTime) is undefined for the type Overage32List32Report_1437995612351_291145 value = YEARS(((org.joda.time.DateTime)field_birthdate.getValue()),((org.joda.time.DateTime)parameter_AsOfDate.getValue())); //$JR_EXPR_ID=20$ According to the DateTimeFunctions.java, my arguments should be accepted.[/code]// ===================== YEARS function ===================== ///*** Returns the number of years between two dates.*/@Function("YEARS")@FunctionParameters({@FunctionParameter("startDate"),@FunctionParameter("endDate")})public Integer YEARS(Object startDate, Object endDate){ I already tried adding to build my project with jasper report 6.0.0 but it is still not working. Kindly help guys T______________T (sorry if i dont know how to put on a frame the codes)
  7. Im trying to get the difference in years between two datetimes and same as benkdishman I encounter similar error. I dont quite understand what you're trying to say tchen. Im a newbie here and not being able to use functions that are supposed to be built in is frustrating.
  8. Hi Sanbez! No but i already found out the answer. To use a list as subreport/table/list element datasource, make sure to create a JRBeanCollectionDataSource first out of the listadd on parameterson the report, select listgo to Dataset properties(Tab)select Dont use any connection or Data Sourceadd Parameter (Name: REPORT_DATA_SOURCE and Expression: select the list data source param)or if the list or set is already a part of the object used as the report's datasource, on the report, select listgo to Dataset properties(Tab)select Dont use any connection or Data Sourceadd Parameter (Name: REPORT_DATA_SOURCE and Expression: "new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource(param)")hope this helps other jasper report users. ^^
  9. Hi Sanbez! Thanks for the reply. I have two subreports. One is on the title. It contains the company name and logo. And I dont have any problem with it. The one on the Detail band is the one which is not shown. <subreport><reportElement x="0" y="16" width="555" height="54" uuid="ae8044f8-7102-4fac-8d74-32269b39f994"/><dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{entries})]]></dataSourceExpression><subreportExpression><![CDATA[$P{0}]]></subreportExpression></subreport>
  10. just kindly show me in detail how to use java beans as datasource. could be like one datasource per subreport. thanks a lot
  11. Good day! I'm new to Jaspersoft and all the articles I've read about using javabeans as datasource for reports with subreports are not working. The main report has data shown but the subreport is blank even if the datasource is not empty and/or AllSectionsNoDetail is selected. I've tried passing the subreport data as param and as field. Both approaches didnt work. It would always say, "WARN JRJdbcQueryExecuter:129 - The supplied java.sql.Connection object is null." I know these is TL;DR but for those who wants to share please answer. Thanks guys! POJO: package com.cmsbeta.hibernate.domain; import java.math.BigDecimal;... public class ChargeTypeAndEntries { private Long id = CptiUtil.generatePrimaryKey();private DateTime createDate;private User createdBy;private String code;private String description;private BigDecimal amount;private Integer vatComputation;private Integer status = 1;private Integer isSpecial = 0;private List<Entry> entries; public Long getId() {return id;} public void setId(Long id) {this.id = id;} ....public List<Entry> getEntries() {return entries;} public void setEntries(List<Entry> entries) {this.entries = entries;}} Report Filter: package com.cmsbeta.web.function.reportfilter.page; import java.util.ArrayList;... public class ChargeTypeListReportFilterPage extends CptiBasePage {@SpringBeanprivate ChargeTypeService chargeTypeService;@SpringBeanprivate EntryService entryService; private String searchCode;private String searchDescription;private Boolean searchIncludeInactive; public ChargeTypeListReportFilterPage() {setPageTitle("report.title.chargetypelist"); TextField<String> code = new TextField<String>("code", new PropertyModel<String>(this, "searchCode"));TextField<String> description = new TextField<String>("description", new PropertyModel<String>(this, "searchDescription"));CheckBox includeInactive = new CheckBox("includeInactive", new PropertyModel<Boolean>(this, "searchIncludeInactive")); Form<?> form = new Form<Void>("form");form.add(new AttributeAppender("target", Model.of("_blank"))); SubmitLink submit = new SubmitLink("submit") {@Overridepublic void onSubmit() {List<ChargeType> chargeTypes = chargeTypeService.search(searchCode, searchDescription, null, searchIncludeInactive);List<ChargeTypeAndEntries> data = new ArrayList<ChargeTypeAndEntries>(); for(ChargeType chargeType : chargeTypes){ChargeTypeAndEntries cae = new ChargeTypeAndEntries();cae.setId(chargeType.getId());cae.setAmount(chargeType.getAmount());cae.setCode(chargeType.getCode());cae.setCreateDate(chargeType.getCreateDate());cae.setCreatedBy(chargeType.getCreatedBy());cae.setDescription(chargeType.getDescription());cae.setIsSpecial(chargeType.getIsSpecial());cae.setStatus(chargeType.getStatus());cae.setVatComputation(chargeType.getVatComputation()); cae.setEntries(entryService.findBySource(CmsConstants.CHARGE_TYPE_SOURCE , chargeType.getId())); data.add(cae);} Map<String, Object> param = new HashMap<String, Object>();param.put("Title", getString("report.title.chargetypelist")); List<KeyValuePair> subreportKvp = new ArrayList<KeyValuePair>();subreportKvp.add(new KeyValuePair(0, "charge_type_entries.jrxml")); try {CmsUtil.showJasperReport(getRequestCycle(), data, "charge_type_list.jrxml", param, subreportKvp);} catch (JRException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}; add(form);form.add(code);form.add(description);form.add(includeInactive);form.add(submit);}} Show report: public static void showJasperReport(RequestCycle requestCycle, List<?> data, String jrxmlFileName, Map parameters, List<KeyValuePair> subreports) throws JRException {JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(data); CmsJasperReportsResource jr; //Create an instance of JasperReport of the subreport then pass that instance to the main report as a parameterif(parameters != null) {putTitleSubreportInParam(parameters); if(subreports != null) {putSubreportsInParam(parameters, subreports);}} else {parameters = new HashMap();putTitleSubreportInParam(parameters);} InputStream jrxmlUrl = CmsJasperReportsResource.class.getResourceAsStream(jrxmlFileName);JasperDesign jasperDesign = JRXmlLoader.load(jrxmlUrl);JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); //produces a .jasper file when compiled using ANTJasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, beanColDataSource); //produces a jrprint file when compiled using ANTjr = new CmsJasperReportsResource(jasperPrint);requestCycle.scheduleRequestHandlerAfterCurrent(new ResourceRequestHandler(jr, null));} Main report:<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.0.3.final using JasperReports Library version 6.0.3 --><!-- 2015-07-03T18:15:40 --><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="Charge_Type_Report" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="f2da39e4-6b1d-46bd-a7de-d8c092a8d640"><property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/><parameter name="TitleSubreport" class="net.sf.jasperreports.engine.JasperReport"/><parameter name="Logo" class="java.lang.String"/><parameter name="Title" class="java.lang.String"/><parameter name="0" class="net.sf.jasperreports.engine.JasperReport"/><queryString language="SQL"><![CDATA[]]></queryString><field name="code" class="java.lang.String"><fieldDescription><![CDATA]></fieldDescription></field><field name="description" class="java.lang.String"><fieldDescription><![CDATA[description]]></fieldDescription></field><field name="status" class="java.lang.Integer"><fieldDescription><![CDATA[status]]></fieldDescription></field><field name="entries" class="java.util.List"><fieldDescription><![CDATA[entries]]></fieldDescription></field><background><band splitType="Stretch"/></background><title><band height="111" splitType="Stretch"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/><subreport><reportElement x="0" y="0" width="555" height="75" uuid="a7e88471-87ab-4fde-af5c-dd9efb3ba01d"><property name="local_mesure_unitx" value="pixel"/><property name="com.jaspersoft.studio.unit.x" value="px"/><property name="local_mesure_unitwidth" value="pixel"/><property name="com.jaspersoft.studio.unit.width" value="px"/><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/></reportElement><subreportParameter name="Logo"><subreportParameterExpression><![CDATA[$P{Logo}]]></subreportParameterExpression></subreportParameter><connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression><subreportExpression><![CDATA[$P{TitleSubreport}]]></subreportExpression></subreport><textField><reportElement x="0" y="80" width="555" height="30" uuid="77214317-16c6-4274-ba47-a6894e398e7c"><property name="local_mesure_unitx" value="pixel"/><property name="com.jaspersoft.studio.unit.x" value="px"/><property name="local_mesure_unitwidth" value="pixel"/><property name="com.jaspersoft.studio.unit.width" value="px"/><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/></reportElement><textElement textAlignment="Center"><font size="16" isBold="true"/></textElement><textFieldExpression><![CDATA[$P{Title}]]></textFieldExpression></textField></band></title><columnHeader><band height="20" splitType="Stretch"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/><textField><reportElement mode="Transparent" x="0" y="0" width="110" height="20" backcolor="#80FFFF" uuid="8c18596e-045e-461d-ab0a-ea1a31aec7be"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/><property name="local_mesure_unitwidth" value="pixel"/><property name="com.jaspersoft.studio.unit.width" value="px"/></reportElement><box><topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/><leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/><bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/><rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/></box><textElement textAlignment="Center" verticalAlignment="Middle"><font size="12" isBold="true"/></textElement><textFieldExpression><![CDATA["Code"]]></textFieldExpression></textField><textField><reportElement mode="Transparent" x="110" y="0" width="370" height="20" backcolor="#80FFFF" uuid="599bd22c-bbb7-4397-b926-c8c17456fcfc"><property name="com.jaspersoft.studio.unit.height" value="px"/><property name="local_mesure_unitwidth" value="pixel"/><property name="com.jaspersoft.studio.unit.width" value="px"/><property name="local_mesure_unitx" value="pixel"/><property name="com.jaspersoft.studio.unit.x" value="px"/></reportElement><textElement textAlignment="Center" verticalAlignment="Middle"><font size="12" isBold="true"/></textElement><textFieldExpression><![CDATA["Description"]]></textFieldExpression></textField><rectangle><reportElement mode="Transparent" x="0" y="-1" width="555" height="20" uuid="d302a302-e5ae-4c65-868f-e5e8497932f7"/><graphicElement><pen lineWidth="0.5"/></graphicElement></rectangle><textField><reportElement mode="Transparent" x="445" y="0" width="110" height="20" backcolor="#80FFFF" uuid="10093ca2-491a-4db5-838f-44faebe163a5"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/><property name="local_mesure_unitwidth" value="pixel"/><property name="com.jaspersoft.studio.unit.width" value="px"/></reportElement><box><topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/><leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/><bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/><rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/></box><textElement textAlignment="Center" verticalAlignment="Middle"><font size="12" isBold="true"/></textElement><textFieldExpression><![CDATA["Status"]]></textFieldExpression></textField></band></columnHeader><detail><band height="83" splitType="Stretch"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/><textField><reportElement x="0" y="0" width="110" height="15" uuid="2a7e1f46-89ee-4276-95b5-c54c85b9fa6e"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/></reportElement><textElement textAlignment="Center"/><textFieldExpression><![CDATA[$F{code}]]></textFieldExpression></textField><textField isStretchWithOverflow="true"><reportElement x="110" y="0" width="334" height="16" uuid="c9f46d33-da4e-44a5-b6fc-cc5e12b16611"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/></reportElement><textFieldExpression><![CDATA[$F{description}]]></textFieldExpression></textField><textField><reportElement x="445" y="0" width="110" height="15" uuid="e7b1b8a3-d7bc-432d-b486-11b3daa53087"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/><property name="local_mesure_unity" value="pixel"/><property name="com.jaspersoft.studio.unit.y" value="px"/></reportElement><textElement textAlignment="Center"/><textFieldExpression><![CDATA[$F{status} == 1 ? "Active" : "Inactive"]]></textFieldExpression></textField><subreport><reportElement x="0" y="16" width="555" height="54" uuid="ae8044f8-7102-4fac-8d74-32269b39f994"/><dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{entries})]]></dataSourceExpression><subreportExpression><![CDATA[$P{0}]]></subreportExpression></subreport></band></detail><pageFooter><band height="15" splitType="Stretch"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/><textField><reportElement x="485" y="0" width="70" height="15" uuid="2e1789d0-d635-468d-8c6f-9d4da77c0c36"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/></reportElement><textElement textAlignment="Right"/><textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}]]></textFieldExpression></textField><line direction="BottomUp"><reportElement x="0" y="0" width="555" height="1" uuid="9392f64f-f2d5-4416-9b38-586bf4754089"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/></reportElement></line></band></pageFooter><summary><band height="42" splitType="Stretch"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/></band></summary></jasperReport> Subreport:<?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.0.3.final using JasperReports Library version 6.0.3 --><!-- 2015-07-03T18:15:38 --><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="Charge_Type_Entries_Report" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="0aa70a7e-5b74-40b6-9f19-7a63b1d04123"><property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/><queryString language="SQL"><![CDATA[]]></queryString><field name="amount" class="java.math.BigDecimal"><fieldDescription><![CDATA[amount]]></fieldDescription></field><field name="description" class="com.cmsbeta.hibernate.domain.EntryType"><fieldDescription><![CDATA[entryType.description]]></fieldDescription></field><background><band splitType="Stretch"/></background><columnHeader><band height="57" splitType="Stretch"><staticText><reportElement x="0" y="39" width="500" height="18" uuid="90bcd75e-481e-42f5-a187-4896b1e9578e"/><textElement><font size="11" isBold="true"/></textElement><text><![CDATA[Entry Description]]></text></staticText><staticText><reportElement x="500" y="39" width="95" height="18" uuid="ff86ec03-5cd8-4983-a8c1-afd6d11e7dae"><property name="local_mesure_unitheight" value="pixel"/><property name="com.jaspersoft.studio.unit.height" value="px"/><property name="local_mesure_unity" value="pixel"/><property name="com.jaspersoft.studio.unit.y" value="px"/></reportElement><textElement><font size="11" isBold="true"/></textElement><text><![CDATA[Amount]]></text></staticText><staticText><reportElement x="0" y="4" width="595" height="30" uuid="de23d538-747a-4021-a8ed-7b744ba9beb3"/><textElement><font size="14" isBold="true"/></textElement><text><![CDATA[List of Entries]]></text></staticText></band></columnHeader><detail><band height="28" splitType="Stretch"><textField><reportElement x="0" y="0" width="500" height="20" uuid="4fe8bf65-eb79-4bfc-8474-3883c371f184"/><textFieldExpression><![CDATA[$F{description}]]></textFieldExpression></textField><textField><reportElement x="500" y="0" width="95" height="20" uuid="3d70aa01-bb72-4226-b672-17a01821891e"/><textElement textAlignment="Right"/><textFieldExpression><![CDATA[$F{amount}]]></textFieldExpression></textField></band></detail></jasperReport>
×
×
  • Create New...