Example 2: Publishing a report to disk
In this example, you will learn how to set up a task to publish the report result in various file formats to the file system repeatedly at the start of each month.
- Take steps 1 and 2 as in Example 1.
- In the Publish tab of the Schedule dialog, click the To Disk sub tab, select the required format, specify the result location, and set the format settings according to your requirements.
- In the Conditions tab,
- In the Time sub tab, define the time zone from the Time Zone drop-down list, then from the Time Type drop-down list, choose Run this task periodically.
- In the Duration box, specify a time period for when the task will be performed.
- Select Monthly from the Date drop-down list and keep the default to run the first day of every 1 month.
- Keep the Time settings as default.
- If you also want to set an event which needs to occur before running the report, select a trigger to bind with the task from the Select a trigger to bind drop-down list in the Trigger sub tab, then specify the trigger logic with time condition.
For detailed information about the logic between the trigger condition and the time condition, see Trigger tab.
- If you want to notify someone of when the task is finished by sending an e-mail, go to the Notification tab and set the settings.
- If you want to specify a timeout for when the scheduled report will be allowed to run, specify the settings in the Duration tab as required.
- Click Finish to have the task performed.
Then, click My Tasks on the system toolbar, you will see that the scheduled task has been recorded in the Scheduled tab. Since you have not specified the duration Run until a time for this task, it will not stop being performed until you delete or disable it from the Scheduled tab.
Notes:
- When you specify to publish the report result to the server resource tree, if the specified folder has a real path, the result will be put to the real path. Otherwise it will be put to the default disk location where server resources are.
- If you specify to publish the report result to a non-existent folder on disk, JReport Server will automatically create it.
- If you use a fixed name to perform the task periodically, only the most recently generated report result will be kept. In order to keep the report result generated every time, you should use the dynamic result file name. Similarly, you are able to input the dynamic directory path to avoid report management difficulties, since when a fixed directory path is specified, too many results may be generated in one directory. For more information, see Appendix 5: Dynamic names.