This project is read-only.
1
Vote

Implement BulkRDLPath

description

Reports/ReportGroup/BulkRDLPath has been implemented in addition to Report. This allows you to manage by a folder or subfolder instead of individual reports. The change proposed is included in rsbuild.xsd, Settings.cs.
 
Sample rsbuild.config
    <ReportGroup Name="ListOfReports" DataSourceName="cmrarchive" TargetFolder="${TargetReportList}"
        ReportServer="RS1" CacheTime="10080">
        <Report Name="TestReport">
            <FilePath>TestReport.rdl</FilePath>
        </Report>
    </ReportGroup>
    <ReportGroup Name="DirOfReports" DataSourceName="cmrarchive" TargetFolder="${TargetReportPath}" ReportServer="RS1" CacheTime="10080">
        <BulkRDLPath>
            <DirPath>Reports</DirPath>
        </BulkRDLPath>
    </ReportGroup>
    <ReportGroup Name="ReportsDev" DataSourceName="cmrarchive" TargetFolder="${TargetReportFolder}" ReportServer="RS1" CacheTime="10080">
        <BulkRDLPath>
            <DirPath>BulkReports</DirPath>
        </BulkRDLPath>
        <Report Name="MixedReport">
            <FilePath>MixedReport.rdl</FilePath>
        </Report>
    </ReportGroup>
 
rsbuild.xsd
<xs:sequence minOccurs="0" maxOccurs="2">
  <xs:element name="Report" type="Report" minOccurs="0" maxOccurs="unbounded" />
    <xs:element name="BulkRDLPath" type="BulkRDLPath" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
 
<xs:complexType name="BulkRDLPath" mixed="false">
    <xs:sequence minOccurs="1" maxOccurs="1">
        <xs:element name="DirPath" minOccurs="1" maxOccurs="1" type="xs:string">
            <xs:annotation>
                <xs:documentation>
                    Relative path to the location or directory containing one or more 
                    .RDL files (relative to location of application).
                </xs:documentation>
            </xs:annotation>
        </xs:element>
    </xs:sequence>
    <xs:anyAttribute namespace="##other" />
</xs:complexType>
 
 
Settings.cs
XmlNodeList reportlist = node.SelectNodes("Report");
                    XmlNodeList bulklist = node.SelectNodes("BulkRDLPath");
                    int i = 0;
                    int reportlistcount = 0;
                    int bulklistcount = 0;
                    if (reportlist != null)
                    {
                        reportlistcount = reportlist.Count;
                    }
                    if (bulklist != null)
                    {
                        bulklistcount = bulklist.Count;
                    }
                    if (reportlistcount > 0 | bulklistcount > 0)
                    {
                        reports = new Report[reportlistcount + bulklistcount];
                    }
                    //
                    //  Start of BulkRDLPath processing, process all files in path/directory
                    if (bulklistcount > 0)
                    {
                        foreach (XmlNode node1 in bulklist)
                        {
                            string collapsedHeight = null;
                            int reportCacheTime = cacheTime;
                            XmlNode nDirPath = node1.SelectSingleNode("DirPath");
                            if (nDirPath != null)
                            {
                                string DirectoryPath = Path.Combine(Settings.CurrentDirectory, nDirPath.InnerXml.ToString());
                                foreach (string RDLFile in Directory.GetFiles(DirectoryPath, "*.rdl"))
                                {
                                    string Files = RDLFile.Substring(RDLFile.LastIndexOf(@"\") + 1, (RDLFile.Length - RDLFile.LastIndexOf(@"\") - 1));
                                    string FileName = Files.Remove(Files.IndexOf("."));
                                    reports[i] = new Report(FileName, DirectoryPath + @"\" + Files, collapsedHeight, reportCacheTime);
                                    i++;
                                }
                            }
                        }

                    }
                    //
                    //  End of RDLPath processing
                    //
                    //  Process list
                    if (reportlistcount > 0)
                    {
                        foreach (XmlNode node1 in reportlist)
                        {
                            string rpName = null;
                            string collapsedHeight = null;
                            int reportCacheTime = cacheTime;
                            XmlNode n11 = node1.SelectSingleNode("FilePath");
                            if (n11 != null)
                            {
                                XmlNode n12 = node1.Attributes["Name"];
                                XmlNode n13 = node1.Attributes["CollapsedHeight"];
                                XmlNode n15 = node1.Attributes["CacheTime"];
                                if (n12 != null)
                                {
                                    rpName = ProcessGlobals(n12.Value);
                                }
                                if (n13 != null)
                                {
                                    collapsedHeight = ProcessGlobals(n13.Value);
                                }
                                if (n15 != null)
                                {
                                    reportCacheTime = int.Parse(ProcessGlobals(n15.Value));
                                }
                                reports[i] = new Report(rpName, string.Format("{0}{1}", Settings.CurrentDirectory, n11.InnerText), collapsedHeight, reportCacheTime);
                            }
                            i++;
                        }
                    }       // end of report list
                    _ReportGroups[k] = new ReportGroup(rgName, targetFolder, dataSourceName, reportServer, reports);
                }
                k++;

file attachments

comments