RunGetData() public method

Read all the DataSets in the report
public RunGetData ( IDictionary parms ) : bool
parms IDictionary
return bool
Example #1
0
        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;

            r.SetReportDefinition(_ReportDefn);
            r.Folder = _ReportDefn.ParseFolder;                         // folder needs to get set since the id of the report is used by the cache
            DataSourcesDefn saveDS = r.ParentConnections;

            if (this.MergeTransactions)
            {
                r.ParentConnections = saveReport.DataSourcesDefn;
            }
            else
            {
                r.ParentConnections = null;
            }

            if (_Parameters == null)
            {                   // When no parameters we only retrieve data once
                if (r.Cache.Get(this, "report") == null)
                {
                    r.RunGetData(null);
                    r.Cache.Add(this, "report", this);                          // just put something in cache to remember
                }
            }
            else
            {
                SetSubreportParameters(r, row);                         // apply the parameters
                r.RunGetData(null);
            }

            SetPageLeft(r);                                     // Set the Left attribute since this will be the margin for this report

            SetPagePositionBegin(pgs);

            //
            // 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

            r.SetReportDefinition(saveReport);                          // restore the current report
            r.ParentConnections = saveDS;                               // restore the data connnections

            SetPagePositionEnd(pgs, pgs.CurrentPage.YOffset);
        }
Example #2
0
        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;
        }
Example #4
0
        // Run the report passing the parameter values and the output
        public void Run(IDictionary parms, OutputPresentationType type)
        {
            r.RunGetData(parms);
            var pgs = r.BuildPages();

            r.RunRender(_sg, type, pgs);

            return;
        }
Example #5
0
        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;

            r.SetReportDefinition(_ReportDefn);
            r.Folder = _ReportDefn.ParseFolder;                         // folder needs to get set since the id of the report is used by the cache
            DataSourcesDefn saveDS = r.ParentConnections;

            if (this.MergeTransactions)
            {
                r.ParentConnections = saveReport.DataSourcesDefn;
            }
            else
            {
                r.ParentConnections = null;
            }

            if (_Parameters == null)
            {                   // When no parameters we only retrieve data once
                if (r.Cache.Get(this, "report") == null)
                {
                    r.RunGetData(null);
                    r.Cache.Add(this, "report", this);
                }
            }
            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
        }
Example #6
0
        private Pages GetPages(Report report)
        {
            Pages pgs = null;

            ListDictionary ld = GetParameters();		// split parms into dictionary

            try
            {
                report.RunGetData(ld);

                pgs = report.BuildPages();

                if (report.ErrorMaxSeverity > 0)
                {
                    if (_errorMsgs == null)
                    {
                        _errorMsgs = report.ErrorItems;		// keep a copy of the errors
                    }
                    else
                    {
                        foreach (string err in report.ErrorItems)
                        {
                            _errorMsgs.Add(err);
                        }
                    }

                    report.ErrorReset();
                }

            }
            catch (Exception e)
            {
                string msg = e.Message;
            }

            return pgs;
        }
Example #7
0
        /// <summary>
        /// Loads the report.
        /// </summary>
        /// <param name='filename'>
        /// Filename.
        /// </param>
        /// <param name='parameters'>
        /// Example: parameter1=someValue&parameter2=anotherValue
        /// </param>
        public void LoadReport(Uri filename, string parameters)
        {
            string source;
            System.Collections.Specialized.ListDictionary ld;
            this.parameters = parameters;
            // Any parameters?  e.g.  file1.rdl?orderid=5
            if (parameters.Trim() != "")
            {
                ld = this.GetParmeters(parameters);
            }
            else
            {
                ld = null;
            }

            // Obtain the source
            source = System.IO.File.ReadAllText(filename.AbsolutePath);
            // GetSource is omitted: all it does is read the file.
            // Compile the report
            report = this.GetReport(source);

            // Obtain the data passing any parameters
            report.RunGetData(ld);

            // Render the report in each of the requested types
            string tempFile = System.IO.Path.GetTempFileName();
            ExportReport(report, tempFile, OutputPresentationType.PDF);
            LoadPdf(new Uri(tempFile));
        }
Example #8
0
        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();

            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

            SetPagePositionEnd(pgs, yOffset);
        }
        public void Rebuild()
        {
            _report = this.GetReport(SourceRdl);
            _report.RunGetData(Parameters);
            pages = _report.BuildPages();

            List<ReportArea> tempList = new List<ReportArea>();
            foreach (ReportArea w in this.vboxPages.Children)
            {
                tempList.Add(w);
            }
            foreach (ReportArea w in tempList)
            {
                vboxPages.Remove(w);
            }

            for (int pageCount = 0; pageCount < pages.Count; pageCount++)
            {
                ReportArea area = new ReportArea(this.DefaultBackend);
                area.SetReport(_report, pages[pageCount]);

                vboxPages.PackStart(area, true, true);
            }

            this.Show();

            if (_report.ErrorMaxSeverity > 0)
            {
                // TODO: add error messages back
                //SetErrorMessages(report.ErrorItems);
            }
        }