It's all about the answers!

Ask a question

In BIRT report, how to throw error when mandatory fields are not filled

Anitha Nalluri (311010) | asked Jul 24 '13, 10:40 p.m.
I have 6 mandatory fields as input for a BIRT Report. If I do not select any value for any of these fields and try to run the report, it shows Loading.... How to throw an error if any of these fields are not filled.

Anitha Nalluri commented 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){
else {

One answer

permanent link
ankur sharma (66212228) | answered Jul 25 '13, 6:25 a.m.
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 )
 else  true;

Anitha Nalluri commented Jul 25 '13, 7:05 a.m.

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.

Your answer

Register or to post your answer.