How to show checkbox (checked or unchecked) in report - jasper-reports

I am using iReport 5.2.0. I'm trying show a parameter as checkbox: checked or unchechecked. How I can solve this task?

Answer by #Kudo
I'm using two images to display checkbox or uncheckbox. In each image, using Image Expression else if. ex: $P{param}.equals("TRUE") ? $P{imagecheck} : $P{imageuncheck}

I'm using a text field with this expression:
$F{b}!=null?"þ":"¨"
and set font: Wingdings.
The first symbol is a checked box, the second is an unchecked box.
So, if I want a check I just send a character from database in field b. If I want a blank box I leave b field null.
... and check this too:
http://jasperreports.sourceforge.net/sample.reference/fonts/
it provides information like "How to ship the required fonts with your report templates when deploying them in the target application, using font extensions."

You do not need to put images to create a checkbox. Just put a 11x11 rectangle. and add 2 pieces of 9x9 lines like "\" and "/" and laminate them(put on top of each other). Make the line at bottom Opaque and right click and send it backward. Make the line at top "not opaque". If not showing one of them true, just play with these back or front settings. Then center those laminated lines into your rectangle. After all you can set print when expression parts by code. thats all!
By the way you can reverse "\" line to "/", by line properties > direction > "bottom up" or "top down" settings. Have a nice day!

Another way is to use unicode ensure your jasper report has an encoding of:
...
<?xml version="1.0" encoding="UTF-8"?>
...
<field name="COLUMN_1" class ="java.lang.Boolean" />
...
<textFieldExpression class="java.lang.String">
<![CDATA[$F{COLUMN_1} ? "\u2713":"\u2717"]]>
</textFieldExpression>
...
Before:
After:

Related

Exclude of bands lead to excess whitespace

Context
Setup: JasperReports server Product Version: 6.0.1 Build: 20141218_0238, CentOS server. I am using their bundled PostgreSQL + tomcat server setup.
In my report i have a table with text field and static field & and a chart in the summary band.
the static fields are in columnHeader band, and text fields are in the detail band.
I require the table because i want the users to be able to export CSV data.
However when the report is viewed as HTML, i want to exclude the two bands mentioned above (detail/columnHeader).
Problem
I am able to exclude the table so that it's not showed using the following:
net.sf.jasperreports.export.html.exclude.origin.band.1=detail
net.sf.jasperreports.export.html.exclude.origin.band.2=columnHeader
This does hide the two bands mentioned above, however now instead of the data - whitespace is shown, i would to know how i can remove it
The red text above was added by me, as you can see there are unwanted white-space between the title and the chart, that was where the columnHeader and detail band were at.
See the JRXML content.
Question
How can I remove the space?
It could be an issue with your styles or theme. I run the report in Jasper studio and there was no white space, but I created dummy styles (table_heading, table_data) and set the default theme for bar chart.
Here is my report
http://pastebin.com/fnAnvBR1
I'm using JasperStudio 5.6.2
Set the following property to true:
net.sf.jasperreports.export.html.remove.empty.space.between.rows
Earlier versions of JasperReports had a typo, for the property (emtpy instead of empty):
net.sf.jasperreports.export.html.remove.emtpy.space.between.rows
For example:
<property name="net.sf.jasperreports.export.html.remove.emtpy.space.between.rows" value="true"/>
<property name="net.sf.jasperreports.export.html.remove.empty.space.between.rows" value="true"/>

Disabling Crostab page break

Background:
I have a report with a large dataset on a crosstab element. The report will only cater to spreadsheet format so the width of the report will not matter.
I have tried setting the Ignore Pagination property to true. Split Type to prevent but some of the data still breaks and moves on the bottom of the sheet.
Any help would be greatly appreciated.
I found the solution to my problem. I was using iReport 3.7.4 and there was a bug in the UI. Apparently the crostabs property ignoreWidth="true" was showing as ticked in the UI but it was actually missing from the xml. You can locate this property in the crosstab tag as shown below:
<crosstab ignoreWidth="true">
...
</crosstab>

using alt in sequence diagrams for starUML

i am not able to discover how to use the alt/combined fragment correctly in starUML,as in there is no way that i am able to provide the condition after the alt fragment appears.can any1 just list down the procedure as to how to do it or a link to some good tutorial.
If you are using StarUML 2 (Beta), you can go through these simple steps:
Add Combined fragment to your sequence diagram:
If you try to add operand(alt partition) through context menu, you'll see that there's no option to add new operand:
3.To achieve this, you can simple copy the already defined operand and paste it under Combined Fragment:
After that, simply add condition clauses in "guard" property of operands and adjust operand heights:
I had just found the steps as following.
Please refer how to set "alt combinedFragment at starUML due to I have no 10 reputation to post image.
1.create a sequence diagram.
2.add a CombinedFragment1 into diagram.
3.change the "seq CombinedFragment1 " to "alt CombinedFragment1 "
4.select the "Interaction Operand"
5.left-click at the "atl CombinedFragment1 ",you will found the one "InteractionOperand1" added into the "alt CombinedFragment1 ".
6.add the 2nd "InteractionOperand", same with step 4,step5, there will a parting line like the following.
7.set the InteractionOperand's Guard data,my is "isInit",you will found it at the alt frame.
8.add the 2nd Guard data,same with the step7.
9.move the diagram to the proper location.
while,I still have something unknown, for example, how to make the frame located at the top front and add a relationship with the "B method".
Wish it helpful to u.
Add an Interaction Operand to a Combined Fragment. When you select the Interaction Operand you should see in the Properties Inspector a 'Guard' field. You can type your condition just there.
Many thanks for your posts.
By the way, I noticed when adding a Combined Fragment from the left Pane,
that the alt keyword could be displayed as shown below,
after selecting the interactionOperator from the right pane,
NB: other useful keywords such as the "loop" one are also available from the above list
When you add a 'Combined Fragment' double click on the name on the diagram
Then you get a small icon with 3 horizontal lines to the left of the name
When you click on that you can get as much interaction operands as you wish

Fix Detail Band Relative To Top In The Page It Is Being Printed

I am using iReport version 4.0.1. I am facing a problem in which I want to display some information that must come on the 2nd page only. So, its neither a FOOTER nor a LAST-PAGE-FOOTER. I am using iReport for generating the jrxml files and the design looks something like below.
{HEADER}
{DETAIL-BAND-1} Remarks: Till this point my 1st page finishes
{DETAIL-BAND-2} Remarks: This is coming from a sub-report
{DETAIL-BAND-3} Remarks : This is coming from a sub-report
Some Random Empty Space Is Left
{DETAIL-BAND-4} Remarks: This is where my 2nd page footer needs to come.
.
.
.
.
{Lots of Bands}
.
.
{MAIN-REPORT-FINISHES}
So, I want the footer (actually it is not a footer, its some detail that only need to come on the 2nd page of the pdf generated by JR) to be fixed relative to the top of the page in which it is being printed. Is there a way to do that?
Thanks
Try to use the property "Print When Expression" and then you can use a variable that already exists in your iReport called PAGE_COUNT and it will be printed only when this expression is true.

Highlighting Flex 3.5 CDATA component in Eclipse

Is there any way to highlight the CDATA component in a .mxml file?
I have Eclipse and Flash Builder 3.5 and the flex components are highlighted, but the CDATA isn't. It contains action script.
Sorry, I meant syntax highlighting. For example:
<mx:Canvas ... >
<mx:Script>
<![CDATA[
private function foo():void {}
]]>
</mx:Script>
I don't think so, but your Outline View should allow you to click on any script tags to highlight them. Unfortunately you can't give them different ID's, so splitting your code among different blocks doesn't help much.