You can help by commenting or suggesting your edit directly into the transcript. We'll review any changes before posting them. All comments are completely anonymous. For any comments that need a reply, consider emailing firstname.lastname@example.org.
We are experiencing playback issues from our video hosting provider. Please check back shortly.
Scheduling - Run Script
The Run Script action allows you to schedule a Python script. In this example we'll store a copy of our report in our database before distributing it
Video recorded using: Ignition 7.9
Transcript(open in window)
[00:00] The run script action allows you to add Python scripting to your reports. Begin on the Schedule panel, under Action, click add a new action here. And we'll go down to new run script action. The run script action is a script that runs on a reporting schedule. If we scroll down here, we see that there are a couple of arguments: the report name, which is the name of the report, the path, so, from the project browser, the path leading to this report, the data map, which lets you access all of you data sources and parameters in the report, and the report bytes, which is just a bit array that is the report itself. Additionally, you need to specify what data format the report is in. You can do it right up here to the right-hand side. Now there's a lot you can do with a run script action. Just to give you an example, I'll go ahead and paste something down here. So what I'm doing here is I'm actually creating a log of every time this schedule runs. So this way, I always know when my reports went out. Additionally, I'm saving a copy of the report as well, so if I ever need to retrieve it, I can just query my database for the bit array. So all my database interactions are occurring up here. And down below, I'm just distributing the report. So in this case, I'm just saving it locally. But you could, of course, email this out, or save it to an FTP server. Like the other actions, the run script can be executed immediately. So let's take a look at my database real quick. We'll open the database query browser. And we're looking at my report log table here. There's nothing here right now. But we'll go ahead and execute. Refresh the query browser one more time. You can see my report saved in there.