CSV - Exporting Data with Automation
The following example, for Logi Info only, shows how to create a process task that exports data automatically:
- As shown above, in your Process definition, add a Task element and set its ID attribute.
- Then add aProcedure.Export CSV element beneath it.
- In the element's Filename attribute, specify the output path and filename, on the web server, for the exported report. The filename should include the ".csv" file extension. The example shown above uses the @Function.AppPhysicalPath~ token to provide the path to the application folder.
- Next, add the required Target.CSV child element, as shown above.
- In the element's Report Definition File attribute, specify the report that contains the data to be exported. Do not select the "CurrentReport" choice in the list of suggestions as it will notwork in this case.
- Your task will need to be completed, of course, with a Response element to run properly.
What happens when your task runs? The data from the specified report's datalayer will be exported to a temporary file in your project folder's rdDownload folder on the web server; then the temp file will be copied to the output file you specified.
If you try to run this task more than once, you'll receive an error. This is due to the fact that Procedure.Export CSV will not overwrite an existing file. Adding a Procedure.Delete File element at the beginning of the task will solve this:
An example of a complete task is shown above. Note the use of the @Function again in the Procedure.Delete File element's Filename attribute.