Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » checking date parameter and changing it to default
checking date parameter and changing it to default [message #753651] Fri, 28 October 2011 08:12 Go to next message
Eclipse UserFriend
Hi,
I'm using deployed WebViewerExample (3.7) and I want to check if the
date parameter has the specified value. The script:
if(params["from_date"].value == '3000-01-01')

doesn't work. What is the proper syntax?

Generally I want the date parameter to have default value if I don't
provide any. I'm running the report remotely from cron in xls format (so
I can't let the parameter dialog appear) and the default values for
from_date and end_date are calculated in Birt (start of the month and
yesterday). I tried to make a script which would allow to put the value
'default' into date parameters:

http://server/frameset?__report=sales.rptdesign&from_date=default&to_date=default&__format=xls

and then change it to default values in birt, but it doesn't allow me to
put strings into date parameters. So i decided to put the fictional
values like 3000-01-01 and convert this values to default ones.

reportContext.setParameterValue("from_date",
reportContext.getDesignHandle().getParameters().get("from_date").getDefaultValue());

Are some more elegant ways to do this?

Thanks,
Rafal
Re: checking date parameter and changing it to default [message #753773 is a reply to message #753651] Fri, 28 October 2011 16:58 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you do not make the parameter required it will automatically use the
default date you set. You can either just add it or if you want to use
an expression do something like:

var myDate = new Date();
myDate.setHours(11);
myDate.setMinutes(59);
myDate.setSeconds(59);
myDate.setFullYear(2010,0,14);
myDate;

Jason


On 10/28/2011 4:12 AM, Rafal Wojtowicz wrote:
> Hi,
> I'm using deployed WebViewerExample (3.7) and I want to check if the
> date parameter has the specified value. The script:
> if(params["from_date"].value == '3000-01-01')
>
> doesn't work. What is the proper syntax?
>
> Generally I want the date parameter to have default value if I don't
> provide any. I'm running the report remotely from cron in xls format (so
> I can't let the parameter dialog appear) and the default values for
> from_date and end_date are calculated in Birt (start of the month and
> yesterday). I tried to make a script which would allow to put the value
> 'default' into date parameters:
>
> http://server/frameset?__report=sales.rptdesign&from_date=default&to_date=default&__format=xls
>
>
> and then change it to default values in birt, but it doesn't allow me to
> put strings into date parameters. So i decided to put the fictional
> values like 3000-01-01 and convert this values to default ones.
>
> reportContext.setParameterValue("from_date",
> reportContext.getDesignHandle().getParameters().get("from_date").getDefaultValue());
>
>
> Are some more elegant ways to do this?
>
> Thanks,
> Rafal
Previous Topic:complicated print form
Next Topic:Native excel file
Goto Forum:
  


Current Time: Thu Apr 25 12:57:22 GMT 2024

Powered by FUDForum. Page generated in 0.03095 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top