Application Description
This sample application demonstrates the use of process tasks to export reports to various formats:
- Export report as a CSV file
<Procedure Type="If" ID="procIfExportCSV" Expression=""@Request.ReportFormat~" = "CSV"" IdeDisplayStatus="Collapsed">
<Procedure Type="ExportToCSV" Filename="@Function.AppPhysicalPath~\ExportedReports\@Session.expFileName~.csv" ID="procExportCSV" IdeDisplayStatus="Collapsed">
<Target Type="CSV" Report="Default" ExportDataTableID="dtWorldPopulation" />
<IfError IdeDisplayStatus="Collapsed">
<Response Type="Report" ID="respReport" IdeDisplayStatus="Collapsed">
<Target Type="Report" Report="Default" />
<LinkParams StatusMsg="Error: The export failed!" inpFileName="@Session.expFileName~" />
</Response>
</IfError>
</Procedure>
</Procedure>
- Export report data to an Excel file, and format the data for use in Excel
<Procedure Type="If" ID="procIfExportExcel" Expression=""@Request.ReportFormat~" = "XLSX"" IdeDisplayStatus="Collapsed">
<Procedure Type="ExportToNativeExcel" Filename="@Function.AppPhysicalPath~\ExportedReports\@Session.expFileName~.xlsx" ID="procExportExcel" IdeDisplayStatus="Collapsed">
<Remark>
<Note Note="Use Excel Output Format attribute to set Excel 97-2003 (.xls) or 2007 (.xlsx) format" />
</Remark>
<Remark>
<Note Note="Specify an Export Data Table ID so only the data itself is exported" />
</Remark>
<Target Type="NativeExcel" Report="Default" ExcelOutputFormat="Excel2007" ExportDataTableID="dtWorldPopulation" />
<IfError IdeDisplayStatus="Collapsed">
<Response Type="Report" ID="respReport" IdeDisplayStatus="Collapsed">
<Target Type="Report" Report="Default" />
<LinkParams StatusMsg="Error: The export failed!" inpFileName="@Session.expFileName~" />
</Response>
</IfError>
</Procedure>
</Procedure>
- Export report as a Word document
<Procedure Type="If" ID="procIfExportWord" Expression=""@Request.ReportFormat~" = "DOCX"" IdeDisplayStatus="Collapsed">
<Procedure Type="ExportToNativeWord" Filename="@Function.AppPhysicalPath~\ExportedReports\@Session.expFileName~.doc" ID="procExportWord" IdeDisplayStatus="Collapsed">
<Target Type="NativeWord" Report="Default" />
<IfError IdeDisplayStatus="Collapsed">
<Response Type="Report" ID="respReport" IdeDisplayStatus="Collapsed">
<Target Type="Report" Report="Default" />
<LinkParams StatusMsg="Error: The export failed!" inpFileName="@Session.expFileName~" />
</Response>
</IfError>
</Procedure>
</Procedure>
- Export report as an Adobe PDF file
<Procedure Type="If" ID="procIfExportPDF" Expression=""@Request.ReportFormat~" = "PDF"" IdeDisplayStatus="Collapsed">
<Procedure Type="ExportToPDF" Filename="@Function.AppPhysicalPath~\ExportedReports\@Session.expFileName~.pdf" ID="procExportPDF" IdeDisplayStatus="Collapsed">
<Target Type="PDF" Report="Default" />
<IfError IdeDisplayStatus="Collapsed">
<Response Type="Report" ID="respReport" IdeDisplayStatus="Collapsed">
<Target Type="Report" Report="Default" />
<LinkParams StatusMsg="Error: The export failed!" inpFileName="@Session.expFileName~" />
</Response>
</IfError>
</Procedure>
</Procedure>
- Export report data to an XML data file
<Procedure Type="If" ID="procIfExportXML" Expression=""@Request.ReportFormat~" = "XML"" IdeDisplayStatus="Collapsed">
<Procedure Type="ExportToXml" Filename="@Function.AppPhysicalPath~\ExportedReports\@Session.expFileName~.xml" ID="procExportXML" IdeDisplayStatus="Collapsed">
<Target Type="XML" Report="Default" />
</Procedure>
</Procedure>
Installation Instructions
- Download and extract the content of the sample application zip file that is attached to this knowledge base article
- Create a new Logi Application using the Logi Studio IDE - follow the installation wizard instructions
- Navigate to the _Settings file, update the path element to point to the installation directory
- In your file system, navigate to Logi application installation directory and replace the _Definitions, _SupportFiles, and _Themes directory with the content from the sample application zip file
- Run the sample application
- Five buttons appear on the sample application: CSV, Excel, Word, PDF, XML
- The content of the compress reports or folders can be found in the ExportedReports directory under application root directory
Further Readings
Working with Process Task: Click Here
Click here to download the items referred to in this article.