If a job is run every day, or multiple times a day, it can be difficult to locate the latest or correct generated file without adding something in the name of the result file that helps distinguish it or make it unique. Creating unique file names will help users identify the different generated file results.
This method requires a view to extract data, and a script to run the view and direct its output. This method can also be used if you want to add a timestamp to the output file created from a Report object.
Although the Skybot job will ultimately run a script, you need to start by first creating a job with the view or report object.
Right-click on a View or Report in the Repository and select Create Job.
The New Job Definition window displays:
Create a script that runs the same View or Report:
The script for a view contains a single command as follows:
SCSERVER10/EXECUTE VIEW(BOBKREPO/CUSTOM0003) PCFMT(*XLS)
RECIPIENT('firstname.lastname@example.org') TEXT('Here is your report')
The script for a report contains a single command as follows:
SCSERVER10/REPORT REPORT(SHAR10/GENERICCRO) TITLE('Time Stamp CRO Report')
PCFMT(*PDF) TOSTMF('/scserver10/swi/repository/SHAR/CRO/Generic CRO Report &×t.pdf') RECIPIENT('email@example.com')
The first example will generate output as HTML and the second as PDF, but the following options are also available by changing the PCFMT values:
There are even more parameters available. To see them, click on the script in the design window and hit the F4 key.
Open the Variables tab and define the TIMEST variable as follows:
Because a timestamp is 26 characters long, make sure the Type of variable is set to Expr (Expression).
Enter the value *NOPROMPT for the Prompt Text.
The Default value in this example is set to the SQL statement--SQL (CURRENT TIMESTAMP). The other available options are: CURRENT TIME, and CURRENT SERVER.
Save the script. Note the name and library, because you will need this later.
From the Repository, right-click on the job and select Advanced Job Edit.
The Skybot job edit screen should open. Scroll down and click the EDIT option to the right of the Commands section:
Select the second command. This will expand it so that you can see the entire thing.
Replace the entire command string with this: RUNSCRIPT SCRIPT(BOBK/SCRIPT1)
In this case, the script created in Step 4 is specified.
Scroll down the page and click Save .
Return to the Repository page in your browser and run the job to validate that it runs successfully.
Still have questions? We can help. Submit a case to Technical Support.