Jump to content
We've recently updated our Privacy Statement, available here ×

C-Box

Members
  • Posts

    910
  • 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 C-Box

  1. How is the package-Structure of our class " EnvParameter"? Is it a) it.uncertainty.dmn.EnvParameter (so that the full resolved class name incl. package would be: it.uncertainty.dmn.EnvParameter.EnvParameter) or just b) it.uncertainty.dmn (so that the full resolved class name incl. package would be: it.uncertainty.dmn.EnvParameter ) ??? The compile error message would tell me, that your given import resolved is directing to a package and not to the concrete class... !??! regards C-Box
  2. Hmm, seems that your import is wrong... try to use it as a package Import instead: import it.uncertainty.dmn.EnvParameter.*; hth C-Box
  3. Does the property "PrintRepeatedValues" of the textfield country set to "false" not work? hth + regards C-Box
  4. Hi, is the parameter really passed for the fill process and also not null? perhaps it's better to use a (common) public getter instead direct access to that field "logo" in your parameter-class "Env-Parameter"? So that you could use $P{EnvParameter}.getLogo() as ImageExpression? Otherwise you could also change the report-language from Groovy to Java... just to see, if the compile process already has problems with your expression. hth + regards C-Box
  5. Your code snippets you've found are plain JAVA code and not for integration into the jrxml-design. So if you run your report manually with API functions of JasperReports (e.g. the common steps: load design, set parameters, fill design, print/mail/export filled report result), then you could use these snippets to check whether the resulting JasperPrint Object contains pages at all and then you could prevent your mail delivery in your code. If you use JasperServer, then the comment above by sthomas_03 would be the solution. hth + regards C-Box
  6. When I remember rigtht, the default ReportParametersMap is CLONED when it's passed to a SubReport. I think you should create an own "TopLevel parameter" of type HashMap and pass this own map as single SubReportParameter from MasterReport to each SubReport. Not sure if each SubReportParameter was cloned also when it's passed to the called SubReport. But worth to give it a try. The other idea would just be a simple ScriptletClass that you could use for collecting such things over several report levels. hth + regards C-Box
  7. Hi again, just tried with JasperSoftStudio 6.6.0 ... also out of the box and it works well. The required library is also included within that JRStudio version: e.g. "C:JasperJaspersoft Studio-6.6.0pluginsorg.apache.commons.lang3_3.1.0.v201403281430.jar" Here is my design - just take a look at the imports at the beginning. Probably you should define the "JasperReports Dependencies" to your design-workspace classpath as well. <?xml version="1.0" encoding="UTF-8"?><!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.5.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="TestLastDayOfPrevMonth" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="5cf53290-7072-4385-835a-aba7cba4db1c"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> <import value="org.apache.commons.lang3.time.*"/> <parameter name="ParamLastDayCalced" class="java.util.Date" isForPrompting="false"> <defaultValueExpression><![CDATA[DateUtils.addSeconds(DateUtils.ceiling(DateUtils.addMonths(new Date(), -1), Calendar.MONTH), -1)]]></defaultValueExpression> </parameter> <queryString> <![CDATA[]]> </queryString> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"> <textField> <reportElement x="230" y="41" width="281" height="30" uuid="2b9e697e-3d75-4fc7-a96d-41e7901c474c"/> <textFieldExpression><![CDATA[$P{ParamLastDayCalced}]]></textFieldExpression> </textField> <staticText> <reportElement x="10" y="41" width="217" height="30" uuid="24c36840-3b6c-4eac-a79b-71a4db495427"/> <text><![CDATA[Last Day of Last month:]]></text> </staticText> <staticText> <reportElement x="10" y="10" width="217" height="30" uuid="68d423b1-c47c-4c53-a736-130cd8641d5c"/> <text><![CDATA[Today:]]></text> </staticText> <textField> <reportElement x="230" y="11" width="281" height="30" uuid="090cdc6e-d2e5-4848-826d-d91ac909763d"/> <textFieldExpression><![CDATA[new Date()]]></textFieldExpression> </textField> </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>[/code]so works as expected. hth + regards C-Box
  8. Hi, will the Title and also the TOC also be part of a JasperReport or is this some content you will generate manually with iText or whatever? I'm not familiar with the (newer) Book logic as I was stuck several years to an older version of iReport/JapserReports (5.5.1) at my old company - but I've read something about generating TOCs etc with the later versions of JasperReports (6.x) . Perhaps you could start "googling" for that also. Otherwise you could generate several so called JrPrint Objects (filled JasperReports) and combine them into one PDF File using the JRExporter Util (no matter if it's X-times the same report or perhaps also different reports) : something like this: JRExporter exporter = new JRPdfExporter(); exporter.setParameter(JRPdfExporterParameter.JASPER_PRINT_LIST, yourPreFilledJasperPrintList); exporter.setParameter(JRPdfExporterParameter.OUTPUT_STREAM, yourTargetPDFStream); exporter.exportReport();[/code]Another solution could also be, to combine several reports into one "big" report using SubReports... so that ALL your static content and dynamic content is just one call to the FillManager and just one simple export call to the JRPdfExporter. You could also create at runtime via API an JRDesign and put several SubReports together using just the Jasper-API ... so many leads to Rome :-) just give it a try. hth + regards the river Elbe down from Dresden ;-) C-Box
  9. The summary band is on of the last band in the report design..so I guess you are mixing up some things. Just put some different colored lines into your column footerband and also in the summary band just to see what band are rendered in what order. Using a subreport in a static band isn't a good idea. If your subreport has a dynamic height just use groupfooters instead of columnfooter. Otherwise just post your jrxmls to take an eye on it. Regards C-Box
  10. Well I think you coud try to set this property also, to keep just the FIRST columnHeader but remove all FOLLOWING ones: <property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader"/>[/code]hth + regards again C-Box
  11. It does not belong to the used designing tool for JasperReports.... it's either whether you take the (good old & fast) iReport or the (insane lame) JasperSoftStudio. Its more because Zebra Printers are initialy designd to print labels send via their own printer language "ZBL".... so sending a 2D PrintJob from Java is quite a pain - but feasible. Many customers of us complained the "poor" quality, as the Zebra Printer interpreted the sent fonts and also barcodes from JasperReports just as an image... so that's why for example a barcode lable design in JasperReports (either if barbecue or barcode4j) won't be as sharp as if you sent it via the lable software that is mostly included with the zebra printers (as they use the ZBL language) . So try to adjust a page format at the printer driver that matches 100% (!) your jrxml layout/pageformat and be aware of the page margings and also if the printer is moving forward to the cutter line (if present), that made us crazy in some former customer projects also. :-) good luck + regards C-Box
  12. Have you already tried to set the XLS Export property at (main) jrxml-report ? <property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="columnHeader"/>[/code](just change it to xlsx for the newer Excel exporter) Also the jasper-wiki has some nice articles concerning preparing "clean" Excel sheets... e.g. https://community.jaspersoft.com/wiki/xls-export-parameters-jasperreports-server#XLS_Export_Parameters hth + regards C-Box
  13. I'm not sure if the "newer" versions of JasperReports have something built-in, but I've done something similiar some years ago for our interactive reporting within our ERP-system with JR 5.5.1, but can't access the jrxmls anymore (as I changed the company) But I'll try to explain.... Just add an "invisible" Parameter (that isn't for prompting) and use only this for your query instead of the origin parameters. Something like: $P{state_id} (= is interactive/for prompting)$P{state_list} (= is interactive/for prompting)$P{hidden4query} (=is NOT interactive/prompting)now create as DefaultParameterExpression for "hidden4Query" an IfThenElse syntax: $P{state_id} != null? "AND ID = " + $P{state_id} : AND STATE IN " + $P{state_list} in your query you could now use: "Select ... From .... Where 0= 0 " + $P!{hidden4query} I'm not sure where exactly the exlamation sign "!" was placed... just play around a bit :-) The In Operator was a bit Tricky but I'm sure, that I used that also in the calculated parameter expression... either with the simple IN sytnax or the more compley $X(IN..) syntax... but this is for you. Should work... and is still working at my old customers :-) hth + regards C-Box
  14. Hi, I'd advice using the also in JasperReports used Apache DateUtils.... the commons-lang3.jar should be available in your classpath of course .... so take a look at this: DateUtils.addSeconds(DateUtils.ceiling(DateUtils.addMonths(new Date(), -1), Calendar.MONTH), -1)[/code]It will calculate the last Day of the previous month from Today (better: the latest second in the previous month :-) ). So an sysout will show you, if you start it today (13.05.2019): Tue Apr 30 23:59:59 CEST 2019 hth + regards C-Box
  15. Well I tried to remind what I've done some years ago for customer... as I said, I can't access the orginal jrxml as I changed the company. So take a look at the sample attached. Run the Main Report with e.g. 27 empty records (so I used just an empty datasource for testing). The BackSide SubReport is also hardcoded with 9 emtpy records.. but I think you will manage to adapt it to your report/data ;-) hth + regards from Dresden/Germany C-Box 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="Mainreport" language="groovy" columnCount="3" printOrder="Horizontal" pageWidth="595" pageHeight="842" columnWidth="185" leftMargin="20" rightMargin="20" topMargin="0" bottomMargin="0" uuid="1a26a677-f7eb-4378-8aae-5c6e04188dfc"> <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[""]]></defaultValueExpression> </parameter> <group name="DummyDuplex" isStartNewColumn="true"/> <background> <band splitType="Stretch"/> </background> <pageHeader> <band height="10"> <printWhenExpression><![CDATA[$V{PAGE_NUMBER} %2 == 0]]></printWhenExpression> <subreport isUsingCache="false" runToBottom="false"> <reportElement x="-20" y="0" width="595" height="5" uuid="76e6c0d9-47c9-4143-a7ba-2d6511e5c907"/> <dataSourceExpression><![CDATA[new JREmptyDataSource(9)]]></dataSourceExpression> <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "SR_BackSide.jasper"]]></subreportExpression> </subreport> </band> </pageHeader> <detail> <band height="260" splitType="Stretch"> <rectangle radius="5"> <reportElement mode="Opaque" x="0" y="0" width="185" height="260" backcolor="#CCCCFF" uuid="66930a98-e323-4fd3-ae34-442e605217fd"/> </rectangle> <textField> <reportElement x="0" y="90" width="170" height="80" uuid="0d823d88-f4ee-4bd7-b4cf-b4312d659b1b"/> <textElement textAlignment="Center"> <font size="18" isBold="true"/> </textElement> <textFieldExpression><![CDATA["Card: #"+$V{REPORT_COUNT}]]></textFieldExpression> </textField> <textField> <reportElement x="38" y="189" width="100" height="20" uuid="77012025-136d-4fec-8360-947bf0170161"/> <textFieldExpression><![CDATA["ColumnNumber:"+$V{COLUMN_NUMBER}]]></textFieldExpression> </textField> <textField> <reportElement x="38" y="209" width="100" height="20" uuid="f2ddaf54-12d2-4a88-a2c8-bdd49ac2b3aa"/> <textFieldExpression><![CDATA["ColumnCount: "+$V{COLUMN_COUNT}]]></textFieldExpression> </textField> <textField> <reportElement x="38" y="229" width="100" height="20" uuid="f52bd9a2-7934-4df1-b3ad-6ba8f7916254"/> <textFieldExpression><![CDATA["ReportCount: "+$V{REPORT_COUNT}]]></textFieldExpression> </textField> <textField> <reportElement x="38" y="170" width="100" height="20" uuid="2e478e5d-f0b2-4424-8150-8c24dd3579aa"/> <textFieldExpression><![CDATA["ModDiv: "+ $V{REPORT_COUNT} % 9 ]]></textFieldExpression> </textField> </band> </detail> <summary> <band height="5"> <subreport isUsingCache="false" runToBottom="false"> <reportElement x="-20" y="0" width="595" height="5" uuid="012baf97-aa0f-4a4e-be92-5090d2576fd0"/> <dataSourceExpression><![CDATA[new JREmptyDataSource(9)]]></dataSourceExpression> <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "SR_BackSide.jasper"]]></subreportExpression> </subreport> </band> </summary> </jasperReport> Sub 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="SR_BackSide" language="groovy" columnCount="3" printOrder="Horizontal" pageWidth="595" pageHeight="842" columnWidth="185" leftMargin="20" rightMargin="20" topMargin="0" bottomMargin="0" uuid="954c6aa1-8b06-4e1e-90be-5cc90a03b216"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <background> <band splitType="Stretch"/> </background> <detail> <band height="260" splitType="Stretch"> <rectangle radius="5"> <reportElement x="0" y="0" width="185" height="260" backcolor="#CCCCCC" uuid="5ad90a00-37cc-4a26-9514-6c297ad8fd2f"/> </rectangle> <textField> <reportElement x="29" y="64" width="128" height="133" uuid="63578029-2122-4f5b-9be0-caeb0bdafdd5"/> <textElement textAlignment="Center"> <font size="18" isItalic="true"/> </textElement> <textFieldExpression><![CDATA["BackSide: #"+$V{REPORT_COUNT}]]></textFieldExpression> </textField> </band> </detail> </jasperReport>
  16. have you set the POSITIONTYPE of the second subreport element and also the break-elements to FLOAT? Or is it still "FixRelativeToTop"? If so, just change it to "FLOAT". If you put the second break behind the second subreport element, you always will get an empty page at the end, as the report won't know that the records are consumed/finished... so I guess, this isn't wanted. actually I think, you wouldn't need a break element at all, as you also could use "RunToBottom" flag on both subReports - of course depending on your structure... so the first one will render your first cards and consume all the page height. now the second one will render your background elements, also consuming all the available page height, and so on... just give it a try. Unfortunately I can't look at my "alternate duplex background sample", as this was done for a customer at my old company that was printing his general terms always on background of odd pages :-( hth + regards from Dresden/Germany C-Box
  17. ...so just use the fill Method (e.g. the JasperFillManager should provide several functions for that purpose when I remember right) and pass the precompiled .jasper file + the connection + the parameters map. The connection isn't stored within the compiled jasper object. Afterwards you can use the JRXlsExporter to export the generated jrprint to an excel file. Hth + regards C-Box
  18. Where did you placed the SumVariable? In GroupFooterBand? Just post your JRXML here, otherwise it would become difficult to find the error. regards C-Box
  19. Just an idea with a StringBuilder variable: Create a new variable with name "MyStringJoiner" of Type java.lang.StringBuilder and set calculation type to NOTHING. As InitalValueExpression you set: new StringBuilder() As VariableExpression you set: $V{MyStringJoiner}.append(",").append($F{Name}) Then you can create a new TextField in your summary band or any group footer band and set as TextExpression: $V{MyStringJoiner}.length() > 1 ? $V{MyStringJoiner}.substring(1):"<no items found>" Here I used just a "AntiIndexOutOfBoundsException-Security" Inline-IfThenElse expression for the case that your query returns no names, then you can't subString the first "useless" comma. So this solution is completely free of any database syntax and uses just JasperReports logic. Of course it iterates through all your resulting records. But you could delete the DetailBand if you just want to display the concated data in summary/groupfooter. hth + regards from Dresden/Germany C-Box
  20. perhaps just an idea.... use simple java objects instead String Collection: something like: public class User{String userName;public User(String name){this.userName = name;}public String getUserName(){return this.userName;}} and when you create your Collection<User> somewhere in your java code and pass this as paramater "userList" to the fill process then you easily could create a JRBeanCollectionDataSource for a SubReport or jus a ListElement DataSourceExpression right in the jrxml-design new JRBeanCollectionDataSource($P{userList}) Perhaps you could also create adHoc another DataSource from just an ArrayList<String> or whatever your parameter is typed of. Just take a look at the provided DataSource Implementations: http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRDataSource.html hth + regards C-Box
  21. The splitting type just tells the engine, if the detailband itself is allowed to split to the next page, if the remaining space at the current page isn't enough. It does NOT tell you, that the report itself should just render one page at all! So in your case, I would just place all your fields to the title section... this is rendered just once and should already has access to all fields of the first resulting record of your query. If you have more that one records you could than print the summary (printwhenexpression) with a hint ... $V{REPORT_COUNT} has perhaps the current (last) number of records.
  22. Just play around with the calculation-time of the variables... I guess you must set it to Group and the correct group-name to get the desired result. To show a sum already in groupheader, you must also change the evaluation-time of the text field to "group" so, that the textfield placed in header-band itself is "re-evaluated" just at the end of the grouping process. But not sure if the percantage to parent total-sum will work, as this (parent)sum isn't finished yet when the first nesting group already ends. Just play around with the increment-type, reset-type and increment-group(s) until you get the desired result. hth + regards C-Box
  23. Don't place it into the header section. I would try to put it into the SummaryBand, so that it's ensured, that the crosstable is just called once. You could delete all other bands (details, columnheader/-footer) if you don't want to show the main query records as well. otherwise post some screenshots with the differences marked hth + regards C-Box
  24. Sound's like a crosstable. Just use the crosstable assistent (should appear when you drop the crosstab-element from tools palette) that should also be integrated in former iReport version 5.0.1 (when I remember right). There you could use for columns also some aggregate/grouping functions. hth + regards C-Box
  25. We use the generic element and an extension to create our own PDFFormFields logic to produce editable forms from JasperReports (Community Edition). So the need was there, but a solution (meanwhile) also :-) Would be fine if someone would create an "easy way" in standard jasperreports release without building own pdfexporter extensions with generic elements. regards C-Box
×
×
  • Create New...