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/
Izenda Reports can be integrated with the navigation, security, and appearance of existing applications. This is done through the code-level API, which can be accessed and extended through the AdHocConfig and AdHocSettings classes. By default, the Izenda starter kit includes pre-built code templates, which can be found in Global.asax.
The Global.asax file, also known as the ASP.NET application file, is a file that contains code for responding to application-level and session-level events raised by ASP.NET or by HTTP modules. At run time, Global.asax is parsed and compiled.
The global.asax provides the ability to customize the following features and more:
Here is an example of what a common global.asax might look like.
<%@ Application Language="C#" %> <%@ Import Namespace="Izenda.AdHoc" %> <script runat="server"> [Serializable] public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig { //the method to be called by each of your reporting web pages in the OnPreInit() method. This will instantiate Izenda reports throughout your reporting application. public static void InitializeReporting() { //Check to see if we've already initialized. if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) return; bool isMultiTenant = false; string role = GetUserRole(); AdHocSettings.CurrentUserName = (string)HttpContext.Current.Session["UserName"]; //Assumes the authenticated username is stored in a session variable AdHocSettings.CurrentUserIsAdmin = (bool)HttpContext.Current.Session["IsAdmin"]; //Assumes the authenticated user's admin status is stored in a session variable AdHocSettings.ShowSettingsButton = AdHocSettings.CurrentUserIsAdmin; AdHocSettings.ShowModifyButton = AdHocSettings.CurrentUserIsAdmin; Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); if (!isMultiTenant) { AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; //Creates a connection to Microsoft SQL Server AdHocSettings.SqlServerConnectionString = GetConnectionString(); //Handle user specific logic AdHocSettings.CurrentUserIsAdmin = (bool)HttpContext.Current.Session AdHocSettings.VisibleDataSources = GetUserDataSources(); } else { string company = GetUserCompany(); //Set connection string per-tenant AdHocSettings.SqlServerConnectionString = GetConnectionStringByCompany(company); //Set the stored reports file folder path per-tenant AdHocSettings.ReportsPath = string.Format("\\{0}\\{1}", company, GetUserDepartment(AdHocSettings.CurrentUserName)); //Set table and view access AdHocSettings.VisibleDataSources = GetTables(role); //get the allowed datasources based on role //Set all other settings if (company=="AcmeWidget") { AdHocSettings.Formats["Currency"] = "{0:#,###.##}"; if (GetUserRole()=="PowerUser") { AdHocSettings.ShowModifyButton=true; AdHocSettings.AllowDeletingReports=false; } } HttpContext.Current.Session["ReportingInitialized"] = true; } // Dynamically modify the report before execution. public override void PreExecuteReportSet(Izenda.AdHoc.ReportSet reportSet) { // Add custom logic to run before the report is displayed } // Dynamically modify the results after they come back // from the database and before they are rendered public override void ProcessDataSet(System.Data.DataSet ds, string reportPart) { // Add custom logic to modify specific areas of the report } } </script>
For more a more detailed code sample, click any of the headings.
To enable a custom configuration, we must put the key and connection string in the InitializeReporting()
method. If settings have already been set on the Settings.aspx page, they should be removed and set via code in the global.asax- otherwise, there could be complications when initializing. When adding custom code for a production integration, we recommend disabling Settings.aspx and Izenda.config altogether to prevent any conflicts from occurring. Here is the process flow for enabling custom code:
InitializeReporting()
method as aboveInitializeReporting()
method as shown in this example.InitializeReporting()
method as show in this example.InitializeReporting()
in the OnPreInit()
method from your reporting web pages.You may now add custom code to Izenda Reports.
Izenda Reports is an ASP.NET application and utilizes an object model. There are two classes upon which an integrator should primarily focus. These classes contain many settings and methods that will help you integrate our application with yours.
InitializeReporting
method to give users roles, hide or show buttons, and much more. However, this does require some experience with C♯ or VB.NET.DataBaseAdHocConfig
or FileSystemAdHocConfig
.Both of these classes are customized by adding your code into the global.asax file, as shown above.
By putting code in the global.asax file, you are simply choosing to use the CustomAdHocConfig
class, which will extend either database mode or file system mode. Unless you specifically override the above methods, they will retain their default behavior.
In general, most custom code will be placed in the Global.asax file. Custom code applies to one of the following contexts:
In the case that you will not be using the global.asax file or that you are using a different global.asax than Izenda's, you can set the license key at the start of the user's session to obtain the same result. You will need to make sure that you set the license key before invoking any of the configuration methods or settings in Izenda Reports. You can also use this guide to decide how to integrate Izenda into your existing application. Note: This requires knowledge of asp.net and C# at the least.
You can use the following steps to allow proper operation of Izenda Reports on distributed cloud computing systems:
InitializeReporting()
method from the OnPreInit() method of all pages that utilize the Izenda API. by default, the demo site already uses this configuration.<configuration> <system.web> <sessionState mode="StateServer" stateConnectionString="tcpip=SampleStateServer:42424" cookieless="false" timeout="20"/> </system.web> </configuration>
Note: Due to the heavy use of session state Izenda relies on for caching images, javascript, and CSS, performance may suffer while using SQL as your state server. We recommend using a third party session state tool such as AppFabric to handle your sessions on a farm. If that isn't an option, you can also use a memory optimized session state provider for your SQL session state server cluster.
Izenda Reports also allows most common settings to be turned on or off through its settings page. In this page you will find that settings have been grouped into categories depending on the function they server. This page can also provide helpful diagnostic data about your application. It is an Izenda best practice to only use the settings.aspx page and izenda.config for trials and evaluations, and not in production.
Last edited by CaseyStokes, 2016-01-21 12:44:56