override internal void Run(IPresent ip, Row row) { Report r = ip.Report(); base.Run(ip, row); // need to save the owner report and nest in this defintion ReportDefn saveReport = r.ReportDefinition; NeedPassword np = r.GetDataSourceReferencePassword; // get current password r.SetReportDefinition(_ReportDefn); r.Folder = _ReportDefn.ParseFolder; // folder needs to get set since the id of the report is used by the cache r.GetDataSourceReferencePassword = np; DataSourcesDefn saveDS = r.ParentConnections; if (this.MergeTransactions) { r.ParentConnections = saveReport.DataSourcesDefn; } else { r.ParentConnections = null; } r.SubreportDataRetrievalTriggerEvent(); if (_Parameters == null) { // When no parameters we only retrieve data once if (r.Cache.Get(this, "report") == null) { r.RunGetData(null); if (!r.IsSubreportDataRetrievalDefined) // if use has defined subreportdataretrieval they might { r.Cache.Add(this, "report", this); // set the data; so we don't cache } } } else { SetSubreportParameters(r, row); r.RunGetData(null); } ip.Subreport(this, row); r.SetReportDefinition(saveReport); // restore the current report r.ParentConnections = saveDS; // restore the data connnections }
// Run the report passing the parameter values and the output public void Run(IDictionary parms, OutputPresentationType type) { r.RunGetData(parms); r.RunRender(_sg, type); return; }
override internal void RunPage(Pages pgs, Row row) { Report r = pgs.Report; if (IsHidden(r, row)) { return; } base.RunPage(pgs, row); // need to save the owner report and nest in this defintion ReportDefn saveReport = r.ReportDefinition; NeedPassword np = r.GetDataSourceReferencePassword; // get current password r.SetReportDefinition(_ReportDefn); r.Folder = _ReportDefn.ParseFolder; // folder needs to get set since the id of the report is used by the cache r.GetDataSourceReferencePassword = np; DataSourcesDefn saveDS = r.ParentConnections; if (this.MergeTransactions) { r.ParentConnections = saveReport.DataSourcesDefn; } else { r.ParentConnections = null; } r.SubreportDataRetrievalTriggerEvent(); int iStartPage = pgs.CurrentPage.PageNumber; // http://fyireporting.com/forum/viewtopic.php?t=774 float fStartYOffset = pgs.CurrentPage.YOffset; // http://fyireporting.com/forum/viewtopic.php?t=774 bool bRows = true; if (_Parameters == null) { // When no parameters we only retrieve data once SubreportWorkClass wc = r.Cache.Get(this, "report") as SubreportWorkClass; if (wc == null) { // run report first time; bRows = r.RunGetData(null); if (!r.IsSubreportDataRetrievalDefined) // if use has defined subreportdataretrieval they might set data { r.Cache.Add(this, "report", new SubreportWorkClass(bRows)); // so we can't cache } } else { bRows = wc.bRows; } } else { SetSubreportParameters(r, row); // apply the parameters bRows = r.RunGetData(null); } SetPageLeft(r); // Set the Left attribute since this will be the margin for this report SetPagePositionBegin(pgs); float yOffset; if (bRows) // Only run subreport if have a row in some Dataset { // // Run the subreport -- this is the major effort in creating the display objects in the page // r.ReportDefinition.Body.RunPage(pgs); // create a the subreport items yOffset = pgs.CurrentPage.YOffset; } else { // Handle NoRows message string msg; if (this.NoRows != null) { msg = this.NoRows.EvaluateString(pgs.Report, null); } else { msg = null; } if (msg != null) { PageText pt = new PageText(msg); SetPagePositionAndStyle(pgs.Report, pt, null); if (pt.SI.BackgroundImage != null) { pt.SI.BackgroundImage.H = pt.H; // and in the background image } pgs.CurrentPage.AddObject(pt); yOffset = pt.Y + pt.H; } else { yOffset = pgs.CurrentPage.YOffset; } } r.SetReportDefinition(saveReport); // restore the current report r.ParentConnections = saveDS; // restore the data connnections // http://fyireporting.com/forum/viewtopic.php?t=774 - START if (iStartPage == pgs.CurrentPage.PageNumber) { _yOffset = yOffset - fStartYOffset; } else { float tmp = 0; if (iStartPage != pgs.CurrentPage.PageNumber - 1) { tmp = (pgs.CurrentPage.PageNumber - iStartPage - 1) * pgs.PageHeight; } _yOffset = tmp + (pgs.PageHeight - fStartYOffset) + yOffset; } // http://fyireporting.com/forum/viewtopic.php?t=774 - END SetPagePositionEnd(pgs, yOffset); }