Question

I'm creating a BIRT report using certain parameters. I have an int parameter (Number of months) which values can be from 1 to 12.

I need to check if the value is bigger than 12. In such case it should show me a customized message and not an error like it is doing right now.

Error:

org.eclipse.birt.report.service.api.ReportServiceException: The validation for parameter "nummonths" fails.

Current script:

if (params["nummonths"].value > 12 )
    {
    false;
    } 
else
    {
    true;
    }

I create reports in BIRT to upload it to IBM Maximo Asset Management system. Maybe there is a different way to solve this in Maximo.

Thanks for your time! Hopefully will help others.

Was it helpful?

Solution

You could create a dynamic text styled as a warning, and hide it (property "visibility") with an expression such

params["nummonths"].value <= 12

There is an example of a such approach here, if we select more than 10 countries or more than 10 indicators, a warning label is displayed at the top of the report.

Example of rptdesign

An interesting point is, although a warning is displayed we can additionally create a rule to replace the wrong parameter value in a script such onCreate. This way the report can correctly run. For example in your case, we could do in a script:

if (params["nummonths"].value > 12){
  params["nummonths"].value=12;
}

Alternatively, you could also drop some report elements in "beforeFactory" when the parameter is wrong.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top