In BIRT report, how to throw error when mandatory fields are not filled
One answer
How about this.
1. Make all your parameters non-mandatory.
2. Add a dynamic text in the beginning of report with logic something like this
if (params["param1"].value == null ) "No Param1 provided";
You may format the test in red.
3. Set the visibility of this text using 'visibility' property and provide an expression like
if (params["param1"].value == null )
false;
else true;
1. Make all your parameters non-mandatory.
2. Add a dynamic text in the beginning of report with logic something like this
if (params["param1"].value == null ) "No Param1 provided";
You may format the test in red.
3. Set the visibility of this text using 'visibility' property and provide an expression like
if (params["param1"].value == null )
false;
else true;
Comments
Thanks Ankur for replying.
I think, this is the best work around for this problem.
But, when I make all the parameters non-mandatory, the report runs automatically for the first time. Is there any way to stop rendering the report for the first time and show the report parameters.
With this solution, as soon as you click on the report, it shows "No param1 is provided". But, we have not given a chance for the user to select the parameter. So, it should first ask to enter the parameter and if the user has not given any input, then this error should come up.
Comments
Anitha Nalluri
Jul 25 '13, 3:46 a.m.I have to validate 2 date fields and 4 List boxes (cascading parameters).
When I click on each of the parameter and wrote below code in validate of script tab, it did not work
if(params["Start Date"].value == null){
false;
}
else {
true;
}