Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Set dynamic default parameter as date
petr.mensk
Hello,
I have a following problem - I am trying to set my date parameter to default value (ussualy beginning of the current month) but field in formular is always empty.
Default value looks like this
date = new Date();
date.setDate(1);
date;
which is supposed to work. When I change the Data type to String, and add date.toString(); in my code, then it's working but I need it to be Date Data type. I am runinng on version 3.2.22.
Thanks for any help.
Find more posts tagged with
Comments
bgbaird
The JS date object has cussed me more heartache than anything else.
Try making the last step as new Date()
Ex:
Var varValue = stuff....
Setting var = stuff...
myDateValue = new Date(varValue);
petr.mensk
Well, I can see why:-)
I tried both
var date = new Date();//also without var
date.setDate(1);
mydate = new Date(date);
and
var date = new Date();//also without var
date.setDate(1);
new Date(date);
and still no result, this is really tough one:)
bgbaird
Here is one that I use:
today = new Date();
df = new Packages.java.text.SimpleDateFormat("MM/dd/yyyy");
today = df.format(today);
var SD=new Date();
var ED=new Date();
var fom = new Date();
fom.setDate(1);
fom = df.format(fom);
SD = fom;
ED = today;
params["StartDate"].value = SD;
params["EndDate"].value = ED;
bgbaird
You can also check out this link:
http://enterprisesmartapps.wordpress.com/2012/08/12/dates-in-birt-datasets/
You can also take a look at the design I'm attaching, something in it might help.
petr.mensk
Thnak you, it worked for me. Finally:)