• Home
  • Data Sources
  • JavaScript

logo

  • Charts
  • Create a Simple Listing Report
  • Create a Simple Listing Report Preview
  • Data Sources
  • EXMIS Data Cleanup Team Dashboard
  • Welcome to MrBIRT.com


BIRT: Add Calendar Widget to Server

image-BIRT Calendar Widget - Report Parameter InputAre you trying to find a way to add a “Calendar Widget” or “Date Picker” to BIRT?

If you just getting familiar with BIRT, then you may be starting to realize that there must be a better way to allow your report users to input dates.

Open source BIRT uses a Text Box for Dates that users input as report parameters. This leaves plenty of room for mistakes.

Open source BIRT does NOT have a built-in Calendar Widget for picking dates. If you want the user to input a date, a text box is your only easy choice.

BIRT-HINTS-Typing Date Parameter into BIRT ReportIf your user inputs the wrong format, the report doesn’t seem to work.

The user may not even know that the problem was his date format (even if you put hints into the parameter window on how to format the report).

 

 

 

 

image-BIRT-Chart-Date Formats for BIRT Report ParametersThey may just blame the report and complain that it’s broken. But the problem isn’t the report at all. The report works fine as long as the dates are input using the correct format.

In a Text Box, dates can be formatted correctly in several different ways. But there’s an infinite number of ways to get the date wrong.

 

 

image-BIRT-Minimize User FrustrationBottomline: There are lots of things that can go wrong when we leave the date parameter open to user input. You can minimize user frustration if you make picking the correct date easy.

 

 

image-BIRT-Common Use of Calendar Widget on the web - examplesPeople don’t need to enter the correct date format when they book a hotel or flight online. There’s a convenient “Calendar Widget” that allows them to scroll through a graphical depiction of a calendar and pick a date. They just need to point and click.

 

 

After searching the forums, googling solutions and checking a lot of broken links, I found a couple of good resources but they were outdated and incomplete. In the end, the solution involved piecing together information from several sources to find and deploy a “Calendar Widget” for BIRT.

Using this information, you’ll learn how to add a “Calendar Widget” to your BIRT Reports. At least on your server. The “Calendar Widget” doesn’t work on the Eclipse IDE for BIRT on our local machines. But, our main concern was the server anyway. That’s where users interact with the reports.

You’ll need the “JSCal2-1.9” folder – let’s just refer to it as the “Calendar folder”. You’ll also need to add code snippets to 2 files on your server.

image-BIRT-Deploy Calendar Widget-Date Picker on ServerDeploy Calendar folder to Server

First, you’ll need to find the “webcontent/birt” folder on your server.

If you haven’t downloaded the “Calendar folder” from mrbirt.com yet, do it now. You’ll need to upload the Calendar folder to your server. I’m using FireFTP. Upload the “Calendar folder” into the “webcontent/birt” folder (folder names may vary a little):

birt/webcontent/birt
or
birt-viewer/webcontent/birt

This upload shouldn’t take too long because it’s not a big folder.

image-BIRT-Add code snippets to files for Calendar WidgetAdd Code Blocks
Next, we’re going to be cutting and pasting a couple of code snippets into 2 files:

• FramesetFragment.jsp
• TextBoxParameterFragment.jsp

To do that, you’ll need to first download the 2 files from the server to your local machine. I suggest you make backups now.

First, download: /birt-viewer/webcontent/birt/pages/layout/FramesetFragment.jsp

After line 130, add the following code:



Save the changes and then upload the updated file to your server. Overwrite the existing file on the server.

Download the second file:
/birt-viewer/webcontent/birt/pages/parameter/TextBoxParameterFragment.jsp

At the end of the file, add the following code right before the last couple of tags in the file:

</TD>
</TR>

Save the changes and then upload the updated file to your server. Overwrite the existing file on the server.

Once you have that done, run the report.

image-BIRT Calendar Widget as Date ParameterWhen the report runs, the parameter window will look a little different. Click the button on the right side of the Text box and you’ll see the BIRT Calendar Widget that you just deployed. Pick a date and a date will be added into the Text box in the correct format for the report.

If your screen shows a working BIRT “Calendar Widget” (aka “Date Picker”), you’ve done it correctly.

Good work! You’ve just eliminated a huge amount of report complaints.

 

 

image-BIRT-Slow Clap-for Calendar WidgetThe next time you walk through the front door of the office, your supervisors and co-workers should be slow-clapping for you as you come in.

Sources:
http://terrarum.net/blog/adding-a-calendar-widget-to-birt.html
http://www.dynarch.com/jscal/

About the Author
Sean is a technology enthusiast and an independent consultant. He has been authoring tech training articles and videos for 7 years. He has a Bachelors of Science degree from the United States Military Academy.

BIRT Calendar Widget / Date Picker

Supporting Downloads

JSCal2-1.9.zip

Code Snippets
FramesetFragment-cs
TextBoxParameterFragment-cs