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

Security Advisories

Downloads

Everything posted by C-Box

  1. Hi, just create a boolean variable (e.g. isClassFieldFilled).... as variable expression you do this: $F{class} != null?Boolean.TRUE:$V{isClassFieldFilled} as initial expression you do this: Boolean.FALSE now you transform you static label in column header to a textfield (in iReport you can do this with context menue) set the following as text expression: $V{isClassFieldFilled}?"Class":"" set the evaluation time of this textfield to REPORT and voilá your column heading for class is just displayed if at least one record has a non null-value in field class assigned. hth + regards from Germany Christian
  2. Hi, we use JR for many years from version 0.5.3 (when I remember right)... the TOTAL_PAGE_NUMBER usage in subreports was discussed often in forum and we actually would need it also (as we also have just ONE global formfooter /-header designed as a subreport) ... but as the variable PAGE_NUMBER is calculated at each (sub)report level individually there wasn't and isn't any chance to achieve this with "normal" JR usage... But it's JR... so it's quite flexible.... just add an property or a key (e.g. "MyTotalPageNumberField") to your TOTAL_PAGE_NUMBER field... after the report has finished just count the pages of resulting JasperPrint Object ... so you have the resulting number of total pages... now loop through every page, parse the elements for your "MyTotalPageNumberField" and replace the content like elem.setText(jrPrint.getPages().size()) and voilà you got it.... we do something similiar with numbering the copy printouts... so that each copy that is passed to the printservice gets its own text like "COPY X/Y".... it's very fast and better than recall the report for every copy printout with a parameter... so as you see... JR is what you want! Just be creative!!! hth + regards from Germany Christian
  3. Hi all, we recently had to design a simple report that display some field values below each other and a longTextField besides (see attached JRXML). so somethink like this: FieldsBelow other Field field1 longTextField field2 field3 field4 ___________________________________________________________ The fields (1-4) placed below each other in one detailband (height let's say 50 pixel) and have "RemoveLineWhenBlank" set to true and "PositionType" set to float so that empty space is surpressed, if there are no values. But now the longTextField besides could have some more lines so it has "StretchWithOverFlow" set to true. If there is just one line of content in longTextField everything works fine... but if the field stretches because of some more content/lines... the longTextField stretches itself AND also the detailband (although the band would just need to enlarge, if there are more that 4 lines of content). So we got some empty space at every detailband that is actually NOT needed. I remember that I discussed this behaviour with Teodor some months/years ago - but can't find the tracker item. So perhaps somebody else has some ideas, how to avoid that. (without a subreport) Note: placing the field 2-4 into another detailband is no opportunity, as first all field values should stay together (even if longTextField stretches) and if field1 is empty field2 should move upwards (already done by a frame element). Actually a very simple problem but I can't find a solution!?!? tia + regards from Germany Christian
  4. Hi Giulio, I just updated our project to new JasperReports 4.1.1 and also iReport 4.1.1 and newly created reports with hyperlinks doesn't work anymore, as the HyperlinkTyps are wrong and our HyperlinkListener in ViewerWindow checks that type to handle different links. (internally the equals method is called by JasperReports and "REFERENCE" is not equal "Reference") As you can edit the combobox manually it's not such critical .... if you know that problem. Nevertheless it would be nice, if you could fix it for the next release. regards from Dresden/Germany Christian
  5. Hi Lucian, I'm currently (re)implementing the font support to our ERP-System and try to use the font-extenion logic as well. We work in J2EE environment (JBoss) and switching the context-classloader is not a good idea. (and also doesn't work) As we need individual fonts at server (while filling) and client side (for viewing/printing) I do store the font-extensions as jar-files in database. So I wrote a "FontsClassLoader" ( already some years ago - initially for loading ttf's to PDF-Exporter -> now for font-extension as jar/zip) that loads that font (extension) from database when needed (and caches of course). But as expected my FontsClassLoader is not used for checking fonts, as the JRFontUtil doesn't use any specific classloader. As the font's could change at runtime (e.g. when user change/redesign templates) it must be dynamically - so just putting the font (extension) to classpath would cause an server-restart. Also deploying to clients classpath would be difficult - that's why I need the FontsClassLoader. Is there any workaround to get the font-extension loaded from database instead just from classpath? (I'm using still 3.7.6) regards from sunny Germany Christian
  6. C-Box

    一般技術情報

    Hi Giulio, as I currently migrate from 3.5.3 to 3.7.6 I wanted to implement the SubreportOpenerProvider for my plugin. But it doesn't work as expected! I debugged the "OpenSubreportAction" of iReport and recognized that you FIRST try to locate the file from expression via "Misc.locateFileFromExpression" but therefore the valueclass must be of type String. If this is not the case, an exception is thrown and the "notifySubreportProviders" is skipped! :-( My SubReport-Expressions are of type "net.sf.jasperreports.engine.JasperReport" and my expression is a call of a given Parameter (e.g. "$P{AFPSDataContainer}.getReport(DruckVorlageReportTyps.RT_VERTEILERINFOS)" as I pass all needed Objects from outside in one "AFPSDataContainer" that holds all needed SubReports (as JasperReport Objects) and SubDataSources .... So from the static constant within the expression I can locate the needed JRXML in Database. Would you be so kind to create a second method within your interface just with two parameters -> e.g.: public File openingSubreport(JrxmlEditorSupport ed, JRDesignSubreport subreportElement); that I could implement to load the needed file just from expression via my plugin??? Would be VERY VERY NICE. tia + regards from snowy Dresden/Germany# C-Box
  7. Hi, just load your JRXML via JRLoader at runtime JRXmlLoader.load(jrxmlFileName); you will get a JasperDesignObject. This object can be changed via normal JasperReports API methods as you want. If you want to save the changes back to (new) JRXML I would advise,first to compile the (changed) JasperDesign to a new JasperReport Object (in memory easily done via JDTCompiler) and write this JasperReport object via JasperCompileManager back to a (new) JRXML File: JasperCompileManager.writeReportToXmlFile(compiledReport, jrxmlFileName); hthregards from GermanyC-Box
  8. Hi Teodor, yes I want to modify all expressions and yes it should be changed in design. It's working fine since 3 months. So the code seems to be ok... (we use 3.5.3 in production mode currently, as I'm at home right now, I can't take a look if the lines of my last note are still the same within my iReport-Plugin - but I will take a look at monday and post if not) Or should the added jrDesignExpression not be written back into design with the Collector!?!? regards from rainy Germany C-Box
  9. Hi Teodor, I just want to change this as resolved if you can confirm that this code is correct to do custum modifications for an expression - either TextExpression, PrintWhenExpression, InitialValueExpression,..... or any other kind of expression within one JRXML: So I collect all expressions via the JRExpressionCollector and call my own method "getVerifiedElementExpression(jRExpression, aktFields, renamedFieldsMap)" that returns a JRDesignExpression with modified chunks. If there was a modification concerning the passed JRExpression I just add the casted JRDesignExpression with new chunks set back to the JRExpressionCollector "exprCollector.addExpression(jRDesignExpression)" It seems to work and if this way is correct the initial problem of this FeatureRequest is solved. tia + regards from frozen Germany C-Box JRExpressionCollector exprCollector = JRExpressionCollector.collector(jasperDesign); Collection expressions = exprCollector.getExpressions(); for (Iterator it = expressions.iterator(); it.hasNext();) { JRExpression jRExpression = it.next(); JRDesignExpression jRDesignExpression = getVerifiedElementExpression(jRExpression, aktFields, renamedFieldsMap); if (jRDesignExpression != null) { exprCollector.addExpression(jRDesignExpression); } }
  10. if you put "org.apache.commons.lang.time.*" into the report imports the expression would just be: DateUtils.addMonths($P{MyDate},-1) just to shorten the expression! (so we do with our own DateLib) just my two cents C-Box
  11. What about passing the whole orderby clause as parameter and just use.. ... ORDER BY $P!{SubReportOrderClause} within the SubReport Query hth C-Box
  12. Just take a look into the datasource sample shipped with full JasperReports Project download... there is a JRBeanArrayDataSource sample that demonstrates how to use an array as datasource. hth C-Box
  13. Have you really set the attribute EvaluationTime to "REPORT" ????? Seems that it is still "NOW" !?!?!??!? hth C-Box
  14. There is no need to use the Summary Band just to show some sum or totals!!! Just put your information into the Title band but set its evaluation time to REPORT instead to NOW (what is default). So there is no need to use a SubReport or anything else! hth C-Box
  15. PrintRepeatedValues just work, if there isn't any PrintWhenExpression set. In Order to have an individual PrintWhenExpression you should change your PrintWhenExpression in matter of returning true if current field value not equals previous field value also. hth C-Box
  16. Your Group "productDetailNewPage" has "Start on a new page" flag set to True so that every group starts on a new page. So I guess this causes the page-break if you have more than one record. Besides that your ColumnFooter is empty (has no elements) but is 30pixel in height, so this space is moved forwards also and can cause pagebreaks also. hth C-Box Post Edited by CBox at 08/24/2009 07:33
  17. I already made a BugReport this week... see here Hope that this will be fixed in 3.5.4 C-Box
  18. Arrrrrghhhhhh..... what's that?!?!?!?? /tools/fckeditor/editor/images/smiley/msn/whatchutalkingabout_smile.gif Okay... first: are you sure to have custom PageFormat of 850 pixel in width and 1984 pixel in height????? a normal A4 Page is 595x842 ... so you have almost 2 and a half of the normal page height definded??? I would first check this out - and fix it to a proper pageformat. Second, you have much space between your last TextElement and your band bottom... this space is moved forwards if other elements are stretching itself. This is, what I mentioned in my last post - strange that you didn't understand it (have you read it at all???? /tools/fckeditor/editor/images/smiley/msn/cry_smile.gif) So just remove this empty space at the end of the detail and try again! When I run your sample with the space removed and 10 empty records I get 10 Pages so works like a charm. hth C-Box PS: by the way there is a negative line within your title band?!?!?!?
  19. What about: JRSaver.saveObject(jasperReport, destFileName); or directly compile to File: JasperCompileManager.compileReportToFile(reportSourceFile, reportDestFile); just look into the API for other parameters. hth C-Box
  20. We do handle this with an automatic verify tool that checks the reportfields against the database structure and change the design if the database model changes... so the reports run fine also when just some fields are renamed or anything like that. (of course the designs are changed, stored & recompiled after that verify process) hth C-Box
  21. Thx Giulio, works like a charm! have a nice weekend! regards from sunny Germany C-Box
  22. Hi Giulio, I do have still some problems with the Opening of JRXML files... now I do this: .... DataObject obj = DataObject.find(org.openide.filesystems.FileUtil.toFileObject(sr.getFile())); OpenCookie ocookie = obj.getCookie(OpenCookie.class); if (ocookie != null) { System.out.println("OpenCookie is da und macht nen Open!"); ocookie.open(); editor = getIReportFrameByFile(sr.getFile()); if (editor != null) { sr.setEditor(editor); } } .... where getIReportFrameByFile(File file) makes this: private static JrxmlEditorSupport getIReportFrameByFile(File file) throws Exception { DataObject dataObj = getDataObjectByFile(file); Set<TopComponent> components = Collections.synchronizedSet(new HashSet<TopComponent>(WindowManager.getDefault().getRegistry().getOpened())); for (TopComponent t : components) { JrxmlEditorSupport jrxmlEditorSupport = t.getLookup().lookup(JrxmlEditorSupport.class); if (jrxmlEditorSupport != null) { DataObject editorFileObj = jrxmlEditorSupport.getDataObject(); if (editorFileObj.equals(dataObj)) { return jrxmlEditorSupport; } } } return null; } The Problem is, that when I want to get the JasperDesign rigjht after opening the file - the methode getCurrentModel returns null and not the model of the JRXML.. as expected...... .... if (sr.getEditor() != null) { JasperDesign design = sr.getEditor().getCurrentModel(); if (design == null) { // here I always get null although the file was opened and I successfully got an editor.... return; } // neue Felder gleich an dieser Stelle refreshen! VerifierUtil.refreshFieldsByPrintDTO(design); } .... When I debugged the "setCurrentModel" of JrxmlEditorSupport I noticed that this is probably just called if the JrxmlVisualView is shown... (at componentShowing or within the run thread method....) So is there another way to open a file to get the JasperDesign right afterwards ? Of course I could load the design via JrxmlLoader but when I changed this object the changes arent visible when the JrxmlVisualView is activated (as another design object is loaded). any ideas would be great! regards from VERY hot Germany C-Box
  23. There for you will have to use the Title band and set "StartTitleAtNewPage" Attribute (at report properties level) to true So you will have to add 1 at your page number variables (like $V{PAGE_NUMBER}.intValue() +1 ) Otherwise you could also introduce a dummygroup surrounding your subreports where you set "ResetPageNumber" ..... but I would try first the Title band with StartTitleAtNewPage like mentioned above. hth C-Box
  24. So if you work with custom datasource (as I do) it's possible, as you know the number of records per group before the actual report fill process... so you could easily make a PageBreakElement with PrintWhenExression like: new Boolean($V{YourGroupCountVariable}.intValue() == $P{TotalRecords}.intValue() - 2) Where $P{TotalRecords} is just a parameter from outside. But if you use SQL... you need the result of the query BEFORE to insert such a page break... How should Jasper know in advance how many records the query returns... the should be run twice to know that value. So I would advise to use a custom-datasource, where I don't see a problem, as you have full control over your data and are able to know in advance at which number the PageBreakElement should print. hth C-Box
  25. The textfield attribute "StretchWithOverflow" should be set to "true", so that the field stretches itself if the text is larger that defined size. (the fields below should have PositionType set to "float") The other approch by API is more for experienced coders and requires runtime compilations (e.g. via JDT Compiler) as you would create a JasperDesign Object by API and need a JasperReport Object for fill process... so if your reports need changements in design at runtime (by user interaction or anything like this) you could use API for changing designs... otherwise (most common) if your reports are PREDEFINED you will better work with the compiled JRXMLs what are the JASPER-Files. hth C-Box
×
×
  • Create New...