Translate

Donnerstag, 15. August 2019

Jasper Reports Studio 6.8 - Tipps & Tricks

some of my findings:

1. Number format, 2 decimals like 123,50 - Designer - sourceTab: <textField pattern="###0.00">

like:








Alternatively you can also place the pattern ###0.00 in the "pattern parameter" as can be seen below under 3.2


2. Report page with two columns: Main Report - Properties - Advanced - columns .. 2

like:



now you content or data will be displayed in two columns like in a newspaper.

First data will occupy the first column from top to down and subsequent data will go into the 2nd column etc.
















an alternative approach with images in columns... - images side by side... in 4. a 2 column page is shown.


3. Summarize fields of detail band:

3.1 My field is called "Kosten" (Format java.math.BigDecimal) -

create a variable called  "SumKosten" (Format java.math.BigDecimal) like below:























3.2 then place a "Textfield" (not "Static Text" !!!) somewhere in the report like:

















4. Image in Report

- In JR Studio Designer select the button to edit the sql sources
- in the lower part of the window select tab "fields" and edit the field e.g. "IMAGE" holding the BLOB of the table
- for class type click the '...' - select list and select image or "java.awt.Image" and OK/save.
- Back in the Studio drag and drop the "image" element from (right hand) "Basic Elements" to the canvas and that looks like:











last step: klick on the image object -  in Image:image "properties" - expression field will be "" (empty) - open the expression editor and select the image object like:













now test...

4.1 Image in report - SQL-statement (changes)

One thing I like to add:
When you change your SQL-Statement and add some fields using the "Dataset and Query Editor" you may want to use "Read Fields" in the upper right corner to populate the columns, which will become the Field names ... you will experience the phenomenon, that the "IMAGE" column (actually of type BLOB) will be populated as "java.lang.string"... !!!! beware of that !!!!
You will have to edit that field and assign the object type : "java.awt.Image" - pls see as under:
















Every time you use "Read fields" you will have to do the above with the IMAGE (blob) column.
An alternative is:
Change your SQL (add columns...) and manually add the fields in the lower part of the editor. Then the image-field will stay and the object-type is not changed.

Keine Kommentare:

Kommentar veröffentlichen