The terminate function provides a scripted way to abort report rendering. For example, if you want the report to only render when there are data records available, you can add a script to the first Section Header > OnRenderBegin:
if (Data.getRecordCount()==0) elxfn.terminate(100,“No records available”);
The status code (101 was chosen here) will be passed back to the caller though the JobInfo. Values less than 100 are reserved for internal use. You could also use terminate to test for valid combinations of parameters.
To download the necessary files for this recipe, refer to the attached ZIP package.
HowToTerminateRenderReport.zip (2.7 KB)