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/
How can I change the data source I'm using for my reports on the fly?
You can change the data source for individual reports by overriding the PreExecuteReportSet method. Here is the source code for changing data sources:
public override void PreExecuteReportSet(Izenda.AdHoc.ReportSet reportSet) { base.PreExecuteReportSet(reportSet); string orig = reportSet.Source; string target = "[dbo].[Orders2]"; if(!orig.Contains("Orders")) { return; //check for strings like "Orders". If that's not found, we return. } foreach (JoinedTable jt in reportSet.JoinedTables) { jt.TableName = jt.TableName.Replace(orig, target); } foreach (Report r in reportSet.Reports.AllValues) { foreach (Field f in r.Fields) { f.ColumnName = f.ColumnName.Replace(orig, target); } } foreach (Filter f in reportSet.Filters) { f.Column = f.Column.Replace(orig, target); } }
Last edited by Joseph Adams, 2014-04-25 13:14:54