☰
Current Page
Main Menu
Home
Home
Editing ArchiveReportOutput
Edit
Preview
H1
H2
H3
default
Set your preferred keybinding
default
vim
emacs
markdown
Set this page's format to
AsciiDoc
Creole
Markdown
MediaWiki
Org-mode
Plain Text
RDoc
Textile
Rendering unavailable for
BibTeX
Pod
reStructuredText
Help 1
Help 1
Help 1
Help 2
Help 3
Help 4
Help 5
Help 6
Help 7
Help 8
Autosaved text is available. Click the button to restore it.
Restore Text
#ArchiveReportOutput() [[_TOC_]] ##About If you want to archive report output every time reports are executed, you could use the ``ArchiveReportOutput`` method. By overriding this method, you could easily archive any report (save to a file, output through FTP, send through email, etc.) The ArchiveReportOutput method is called when any type of export (except HTML) or scheduler runs. This method is called only when the process of executing the report is associated with the file creation process (such as exports to PDF, Word, Excel, etc.). This method is not called when you simply view reports in the Report Viewer or when you call the scheduler with a non-file content generating type such as Link, Embedded or HTML. There isn't a way to configure this to run in the viewer. In the example below, we will only archive reports made by a particular user. ##Global.asax (C♯) ```csharp //main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig { public override void ArchiveReportOutput(ReportSet reportSet, string[] emails, string extension, byte[] data) { // Use archiving only for scheduler if (!AdHocContext.SchedulerExecuting) return; // Check for permissions if (reportSet.Owner != "test@test.com") return; // Look up report archive directory string reportPath = savePath + LookUpTenantID(reportSet.Owner) + "\\"; if (!Directory.Exists(reportPath)) Directory.CreateDirectory(reportPath); // Save report output to the archive using (FileStream sw = new FileStream(reportPath + reportSet.ReportName + "." + extension, FileMode.Create)) using (BinaryWriter bw = new BinaryWriter(sw)) bw.Write(data); } } ``` ##Global.asax (VB.NET) ```visualbasic 'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig Public Class CustomAdHocConfig Inherits Izenda.AdHoc.DatabaseAdHocConfig Public Overrides Sub ArchiveReportOutput(ByVal reportSet As ReportSet, ByVal emails() As String, ByVal extension As String, ByVal data() As Byte) ' Use archiving only for scheduler If Not AdHocContext.SchedulerExecuting Then Return ' Check for permissions If reportSet.Owner != "test@test.com" Then Return ' Look up report archive directory Dim reportPath As String = savePath + LookUpTenantID(reportSet.Owner) + "\\" If Not Directory.Exists(reportPath) Then Directory.CreateDirectory(reportPath) ' Save report output to the archive Using sw As New FileStream(reportPath + reportSet.Name + "." + extension, FileMode.Create) Using bw As New BinaryWriter(sw) bw.Write(data) End Using End Using End Sub End Class ``` **Note:** You might like to run auto-archiving only when the scheduler executes. Using [[SchedulerExecuting|/API/CodeSamples/SchedulerExecuting]], you could know if this output is generated by the scheduler.
Uploading file...
Header
 **This documentation is for the legacy Izenda 6 product. Documentation for the new Izenda 7 product can be found at [[https://www.izenda.com/docs/|https://www.izenda.com/docs/]]**
Sidebar
 --- * [[Izenda 7 Series Documentation|https://www.izenda.com/docs/]] * [[Release Notes]] * [[Upgrade Best Practices|FAQ/Izenda-Update-Best-Practices]] * [[FAQ]] * [[Tutorials]] * [[The Izenda API|/API/AdHocConfig]] * [[The AdHocSettings class|/API/AdHocSettings]] * [Developer Links and Guides](/Guides/Developer-Links-and-Guides) * [[Known Issues]] --- * <a href="http://www.izenda.com" rel="nofollow" target="_blank">Izenda Website</a> * [Product Video](https://www.youtube.com/watch?v=X3-yWFq0w5A) * <a href="http://www.izenda.com/blog" rel="nofollow" target="_blank">Izenda Blog</a> * <a href="http://www.izenda.com/company/" rel="nofollow" target="_blank">About Us</a> * <a href="http://www.izenda.com/contact-us/" rel="nofollow" target="_blank">Contact Us</a> --- * [Guide To Report Design](/Guides/ReportDesign) * [Making Custom Forms Video](http://www.youtube.com/watch?v=5b2axJlgdFs) --- * [[Acknowledgements]]
Edit message:
Cancel