dknutson Posted April 11, 2012 Share Posted April 11, 2012 I need to have a date parameter that will default to yesterday. I've read a number of post on creating custom input controls, and I've dug into the DefaultParametersForm.jsp. I've even purchased the latest version of the Jasperserver Ultimate Guide. I'm just not getting it. Does anyone have a form sample that set's a default date? Link to comment Share on other sites More sharing options...
lwang2012 Posted April 12, 2012 Share Posted April 12, 2012 set the default value of that parameter;the paramter has same id with that input control;the default value can be set by Java expression. Link to comment Share on other sites More sharing options...
dknutson Posted April 12, 2012 Author Share Posted April 12, 2012 That's how to change it in the report using iReports. I need to know how to do this in the input control. What I actually will need later on is much more involved than a simple default date, but I thought that figuring out how to set that in the input control would be a good place to learn how to make a custom input. Link to comment Share on other sites More sharing options...
rault Posted April 23, 2012 Share Posted April 23, 2012 Sounds like you are just starting out. Let's say you add an input control with an ID of MY_INPUT_CONTROL. You'll then need to create a parameter with the name "MY_INPUT_CONTROL". Jasper somehow figures out that these two match up. Then, in the default expression for the parameter I think you can just put "new Date()" if you are using the single input control with a Date data type. Even if your input control is a type of Text, you should be able to put "new Date().toString()" as the default expression.Since Jasper matches up your parameter and your input control, your input control will get the value of the default expresison. Hope that makes sense, but that's how it works. Post Edited by rault at 04/23/2012 20:28 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now