Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Date Parameters
grtgatsby
I have from and to dates as my report parameters and would like to default (From Date) with first date of current month and (To Date) with last date of current month. 90% percent of the time that is what they will enter. Date Format is MM/dd/yyyy. Any help would be appreciated.
Find more posts tagged with
Comments
grtgatsby
Ok ... I figured out how to get the date.
var x = new Date();
var now = new Date(x.getFullYear(), x.getMonth()+1, 0);
To_Date = now;
Now, I can't get it to display in my parameter text box. I've tried several ways. What's the trick?
mwilliams
Hi grtgatsby,
What version of BIRT are you using? If you're using a newer version, like 2.5.1, you can enter a javascript expression as the default value of a parameter.
grtgatsby
Using v2.3.2
grtgatsby
I didn't post From Date. Here's what I did:
var x = new Date();
var now = new Date(x.getFullYear(), x.getMonth(), 1);
From_Date = now
mwilliams
grtgatsby,<br />
<br />
I'm not sure I'm understanding your last post. If you can upgrade to 2.5.x, you can use an expression builder for your default value. Otherwise, you can do something like the following example from the devShare, which uses a combo box type parameter to have a default value of the last day of the month, but also has an input box for a manually entered date value:<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/devshare/designing-birt-reports/687-set-a-date-parameter-value-to-last-day-of-the-month/#description'>Set
a Date Parameter Value to last day of the month - Designs & Code - BIRT Exchange</a><br />
<br />
Or, you could create your own parameter page where you may have more control over defaults. The following devShare post should help get you started on a custom parameter page:<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/devshare/deploying-birt-reports/298-2-2-birt-tag-library/#description'>2.2
BIRT Tag Library - Tips & Tricks - BIRT Exchange</a>
grtgatsby
I'm using Birt Report Engine v2.3.2 inside IBM's Rational Business Developer. Is there a new release for commercial products.
mwilliams
grtgatsby,
I don't believe there's a way for you to use 2.5.x with Rational. You'll have to wait til IBM has a version of RBD that uses 2.5.x. For now, you should be able to create your own parameter page still and have your default values coded in your jsp page.