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. You could just select your field as a Date field and could define a pattern( or even a pattern-expression) like this at your date-textfield: "EEEE"[/code] Or even use a SimpleDate format expression for a String-TextField: new SimpleDateFormat("EEEE").format($F{YourDateField});[/code]If your passed REPORT_LOCALE is set to french, then the formatting output should also be in that language. Not tried, but should work. hth + regards C-Box
  2. Take a look into my answer some days ago for that topic: https://community.jaspersoft.com/questions/1139066/split-field-basis-delimiter-and-print-all-strings there I described, how to generate a list/subreport just for some delimeted Strings or an arry of Strings. I guess this could help you also. :-) hth + regards C-Box
  3. I guess you will have to build a font-extension for your Arial-Unicode font and set the pdf-encoding to IDENTITY-H and not to Cp1250 (what is central european... a bit far away from our chinese friends!??! :-) ) Also I'd advice not to adjust the pdf-encoding stuff at each single TextElement level but instead on a default-style report level... otherwise the report is heavy to maintain later. The font-extension must be within the classpath or your java-application (if you export reports from that and not only from designer) just see the JasperReports Docus e.g.: https://community.jaspersoft.com/documentation/tibco-jaspersoft-studio-user-guide/v640/working-font-extensions hth + regards C-Box
  4. Just use a simple IfThenElse Expression for your date field (e.g. here without text pattern for a java.util.Date Field, but instead with a SimpleDateFormat for a plain StringField): $F{YourDateField} == null ? "no date found": new SimpleDateFormat("dd.MM.yyyy").format($F{YourDateField})[/code]If you have multiple date fields and you just want to define the static text once, you also could use an own parameter (without prompting) with a default expression for your default static text: $F{YourDateField} == null ? $P{YourDefaultText4NullDates}: new SimpleDateFormat("dd.MM.yyyy").format($F{YourDateField})[/code]Another way could also be a static scriptlet method within a small java proggi that handles your logic on a central point: YourScriptletClass.getDateOrText($F{YourDateField})[/code]so like always: Many ways leading to Rome :-) hth + regards C-Box
  5. Sorry had unfortunately no time yesterday to take an eye on it. Why do you use the HorizontalPrintOrder in your List? As far as I know I always came in trouble when I mixed the printorder from calling main report and used subreports... (As I wrote already I don't like using list and frames). I just used horizontal print order when I designed some lables in multiple columns reports. For your table sample it should be enough to use the default vertical print order, as the content is just one column layout. hth + regards C-Box
  6. Perhaps you could use a non breaking space character ("u00A0") instead of a real empty textfield, that probably will be removed when exporting to word, as it's empty. So the defined font, should actually also be kept in doc(x)-exporter, as the textfield isn't really empty. Not tried, but worth to test hth + regards C-Box
  7. Difficult to help... why do you use nested container elements (Frame -> List -> Frame -> Table) ??? In my experiences the frame-element is a bit let's call - "buggy". At least, it doesn't behave always as expected. I just use frames if I place elements side by side, where the RemoveLineWhenBlank won't work... otherwise I avoid using frames, as the remaining space calculation seems to be "tricky" and sometimes the bands doesn't shrink, although the frame isn't as large as defined. But this is another topic. Perhaps you should post your jrxml prepared with empty datasource(s) for your report to throw an eye on it. hth + regards C-Box
  8. No problem! Nice, when it works now & I could help! regards from Dresden/Germany C-Box
  9. I would use following as Default Expression for your Integer Parameter: $P{s_incident} == null || "".equals($P{s_incident}.trim())? new Integer(0) : Integer.valueOf($P{s_incident}) hth + regards C-Box
  10. Hi, I'm not familiar with JSON as DataSource... so that's why just the second part, how to transfer fields to the SubReport. Therefore you can create so called "SubReportParameters" at the SubReport-Element in MainReport. You must define a SubReportParameter let's say "SR_Name" and as Expression you link to the (current) field value ... e.g. $F{name} In your SubReport you define now a new (normal) Report-Parameter with the same name (in our sample "SR_Name") so that you could now use this "normal" parameter as $P{SR_Name} in your SubQuery or whatever else. hth + regards C-Box
  11. I guess your detail for the last record is actual started at page 11 and now the enginge recognized that your description is probably StretchWithOverflow=true and that's why the whole content won't fit into the remaining space at page11... so a page-break will be done and the whole detail is transferred to the page 12. But the variable for your carry is already evaluated, as the band already started. So this is what I guess! (not verified, but after "some" years of using JasperReports). To prevent this you could either try to set the SplitType of your detail to "PREVENT"....or you could try to create a "dummy group" with an attribute "MinHeightToStartNewPage" > 30px (or an other TrialAndError value) or you also could use another detail-band for your "splitting" content and just place the "one-line" fields including amount into the first detail. If you look into the JasperSoft-Tracker you will find a BugReport some years ago, where I discussed the "Strange Carry Calculation" with Teodord Danciu.... When I remember right, the result of this was a new Splitting type "immediate" .... but I forgot unfortunatly what exactly this is doing. (and it just worked for simple layouts, but not complex SubReports Frames Structures) So finally just give it a try ... the last chance would be to correct it in the generated JasperPrint Object by JavaAPI... (this is, what I did finally ... so I just "marked" the amount fields and calculate it's contents for a Sum per page and "correct" the JRPrintText of the CarryField at the bottom per page - not nice, but working at many customers since several years) hth + regards C-Box
  12. You could 1. create an Array of Strings based on your Field: $F{ColumnD}.split(",") [/code]and 2. create an ArrayList of that: Arrays.asList($F{ColumnD}.split(",") [/code]and 3. use this list for an ListElement or even a SubReport as a JRBeanCollectionDataSource using finally this as DataSourceExpression: new JRBeanCollectionDataSource(Arrays.asList($F{ColumnD}.split(",") ))[/code]in your List or SubReport you must create a Field named "_THIS" of type String that you can place within the Listelement or the detail of your SubReport. just tried it out with following parameter in a new empty (main) record: <parameter name="MyStrings" class="java.util.List" nestedType="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA[Arrays.asList("Record1", "2. Record","and the third one")]]></defaultValueExpression> </parameter>[/code]and this for SubReport expression: <subreport> <reportElement x="0" y="10" width="545" height="60" uuid="7f7e06fb-1788-4fdc-a1a3-3f5dd3745533"/> <dataSourceExpression><![CDATA[new JRBeanCollectionDataSource($P{MyStrings})]]></dataSourceExpression> <subreportExpression><![CDATA["StringListAsDataSource_Sub.jasper"]]></subreportExpression> </subreport>[/code]and this as whole SubReport: <?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="StringListAsDataSource_Sub" pageWidth="595" pageHeight="842" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="9d9ea5fd-fadc-4890-827f-369ee64374e3"> <property name="com.jaspersoft.studio.unit." value="pixel"/> <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> <queryString> <![CDATA[]]> </queryString> <field name="_THIS" class="java.lang.String"/> <background> <band splitType="Stretch"/> </background> <detail> <band height="30" splitType="Stretch"> <textField> <reportElement x="0" y="0" width="440" height="30" uuid="2beea897-e04d-4bc2-aa50-1238ad9aef85"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="837e5d94-d9e1-4f14-af77-3dc9369ce311"/> </reportElement> <textFieldExpression><![CDATA[$F{_THIS}]]></textFieldExpression> </textField> </band> </detail></jasperReport>[/code] hth + regards C-Box
  13. When I remember right, the JDBC drivers included in old iReport were just the free licenced (e.g. LGPL) ones. Not sure, what oracle licenced it's JDBC driver but I guess, you must include the jar to classpath (via options menu) manually. Be aware with "modern" driver versions, as iReport is actually (kind of) "deprecated" and is just running with Java7. A new JDBC driver by oracle could be compiled with newer java versions (>= 1.8) and will throw exceptions when used. So you will need to copy a "old" driver compiled with JRE <= 1.7 hth + regards C-Box
  14. there are several ways... you can use the BREAK-ELEMENT to manual create a page-break between some fields at your detail band.... or you could also create some groups and use the built-in feature "StartOnNewPage" at group-level. So many ways leading to Rome! ;-) hth + regards C-Box
  15. Have you already tried to remove the deprecated StretchingType "RelativeToTallestObject" and replace it with the "newer" ones "ContainerHeight" or perhaps to build an element group for rectangle and subreport and use the stretching type "ElementGroupHeight" instead? In former JasperReports version I always used lines to create surrounding rectangles because of this "strange" behaviour" when pages break. But unfortunately this won't work with "nicer" looking rounded rectangles. htt + regards C-Box
  16. Be sure, that your TextField - where you adjust the "link" to the style - doesn't have set the mode set to TRANSPARENT explicit. (so check the TextField attributes in jrxml source as well!) If so, the textfield attributes will override the (conditional) Style attributes... so in former times, the old designer iReport sometimes set the color to white and the mode to transparent and you had to remove these attributes at JRXML level to get the (conditional) opaque style working. Not sure what the current JasperSoft Studio does. Just try it out. hth + regards C-Box
  17. Where do you need your "certain values" exactly? In MainReport as a result from SubReport? Or outside your whole report in your (calling) java application? It's not clear for me, what exactly you want to achieve with the result of column B in your third record!??!?! If you just want to calculate something at MainReportLevel based on that certain third value in columnB from a SubReport, than you could use a ReturnVariable. In your SubReport you could use a simple variable let's call $V{MyColumnBatRecord3} - with an if-then-expression that "remembers" the value of column B in the 3. record: $V{REPORT_COUNT} == 3? $F{fieldColumnB} : $V{MyColumnBatRecord3} but as I said, it's not exactly clear for me, what you actually want to achieve. hth + regards C-Box
  18. I guess (not tried) you could use the $R{ResourceName} Syntax in your Report instead of static texts. IMHO the $R{..} Expressions uses i18n resources, that you could easyly create outside the report for different languages. The REPORT_LOCALE and the RESOURCE_BUNDLE will than decide what properties file is used for the given language. Perhaps you should also take a look here: https://community.jaspersoft.com/documentation/jasperreports-server-user-guide/localizing-reports hth + regards C-Box
  19. Perhaps an slight idea.... at Report-Level you can adjust a property, if the Summary-Band should also have PageHeader-/Footer or if not. The default value is false. So just set it to true, to let the page-footer also appear at Summary band. So if the origin problem is just the missing pageheader-/footer at the summary, this could help. hth + regards C-Box
  20. Hi Dan, I also used let's call "hidden" calculated parameters for the (main) query that depends on the original interactive parameters given by the user in some customer reports some years ago. When I remember right, you must use the exclamation mark somewhere "!" for the calculated parameter.... so that not the "$P{Parameter1}" as string is evaluated in the expression but it's actual content instead. Also the "hidden" (not askUser) parameter must be in the parameter order AFTER the interactive user-parameter(s)... otherwise it would always be null. So try to use $P!{Parameter2} in your query. (can't look for a real sample, as I doesn't have access to that reports any more, so I'm not 100% sure ...could also be the way around for parameter1 - just play around with both ways ) hth + regards C-Box
  21. You could just use the (old) SimpleDateFormat for that: new SimpleDateFormat("hh:mm:ss").parse($F{YourTimeFieldAsString})[/code]This should return a new java.util.Date with the parsed time but the 1.1.1970 (so the day/month/year are quite useless for your purpose). Otherwise you could also use the "newer" Java LocalTime object... e.g. https://www.mkyong.com/java8/java-8-how-to-convert-string-to-localdate/ hth + regards C-Box
  22. What content has your Field "Pro_Divider1" ?? .... is it just a String like "123" or some with comma "123,45" ... be aware, that in Java the decimal separator is a "." and not a "," when parsing it from String. Also be aware, that a divide needs an Arithmetic context so better use something like this: $P{Number10}.divide($P{Number3}.multiply($P{Number2}) ,3, BigDecimal.ROUND_HALF_UP)[/code] that shoud return 1,667 as it's limited to 3 digits after the decimal separator. hth + regards C-Box
  23. have you already tried: Boolean.TRUE.equals($P{REPORT_PARAMETERS_MAP}.get("YourBooleanParameterName"))[/code]that should be null-safe and IMHO works. hth + regards C-Box
  24. Have you already tried to adjust the "WhenNoDataType" to "All Sections NoDetail"? Also you could add a dummy group to the Main-Book Report and place all your "independet" reports to that group instead of the default content (what is the detail band). I guess (!) these DummyGroup bands should than be rendered because of "AllSectionsNoDetail" type. (but not sure... I'm not familiar with books until now) Otherwise just use an EmptyDataSource for Main-Book.-Report and use the former Main-Query as SubQuery and pass these to the dependet Reports. This it, what I'd try first hth + regards C-Box
  25. I guess you will create a simple ChartCustomizer for that. Just take a look here https://mdahlman.wordpress.com/2010/08/18/chart-customizers-1/ and also https://mdahlman.wordpress.com/2011/04/17/chart-customizers-2/ where MDahlman posted some good snippets/samples for "inspiration" :-) just googled it 4u: https://stackoverflow.com/questions/15024082/how-can-i-rotate-itemlabels-above-bars-in-bar-chart-of-a-jasper-report could be a solution. ;-) hth + regards C-Box
×
×
  • Create New...