Alternatives to separate subreport files.

3 posts, 0 answers
  1. Randy
    Randy avatar
    12 posts
    Member since:
    Apr 2014

    Posted 12 Jun 2014 Link to this post

    So I am working on a proof of concept application that uses the HTML5 report viewer to display reports on a server. I am using sub-reports and drill-through reports quite a bit and it raises a question for me, or perhaps more accurately a concern. The reports obviously work just fine if they're in the same directory, however it would be fairly easy to forget to place them in the same location on the server and or just leave one out which would obviously cause that part of the report to fail. My question is what kind of alternatives (if any) do I have to add the same type of functionality without needing separate files. 

    Ideally I'd like it to be something to the effect of display a report that has a link, when you click on the link the report looks inside itself and uses information that is there to hide all the old stuff and display new information (from a different data source) and the report viewer would have the 'history' so that navigating back would revert all those changes with the back arrow. I imagine that it's possible to do with a visibility toggle, but I'm not sure if that's what I should be looking into. Any advice would be appreciated, and I hope that I made it clear enough what I'm looking for.

    -Randy
  2. Randy
    Randy avatar
    12 posts
    Member since:
    Apr 2014

    Posted 12 Jun 2014 in reply to Randy Link to this post

    While I'd still be interested in hearing if the above is possible, I'm also open to the idea of just having two separate files on the server and using them that way. The problem I seem to be having with that approach though is if I use the file names than it gives the error 'An error has occurred while processing SubReport 'subReport1':
    Could not find file 'C:\Program Files (x86)\IIS Express\(filename).trdx'.
    The odd thing is that in the report designer it works just fine, but not through my html5 report viewer. 

    The error isn't entirely un-expected since it's looking for a physical address when it should be looking for a URI, so than I changed it to use the URL that it is available from directly and I get the error 'An error has occurred while processing SubReport 'subReport1':
    For security reasons DTD is prohibited in this XML document. To enable DTD processing set the DtdProcessing property on XmlReaderSettings to Parse and pass the settings into XmlReader.Create method.' The issue with this error is that I'm not directly using any XMLReader when I resolve the report as can be seen in my Resolve method 

    public ReportSource Resolve(string reportId)
            {
                    var reportXml = "";

                    var fileService = new ReportFileService();
                    string library = "Reports";
                    DataQuery dq = new DataQuery();
                    string reportFileName = DataQuery.getReportFileId(reportId);
                    if (fileService.FileExists(library, reportFileName))
                    {
                        reportXml = fileService.LoadFile(library, reportFileName);
                    }

                    if (string.IsNullOrEmpty(reportXml))
                    {
                        throw new System.Exception("Unable to load a report with the report name: " + reportFileName);
                    }

                    return new XmlReportSource { Xml = reportXml };
                }
            }





  3. DevCraft banner
  4. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 17 Jun 2014 Link to this post

    Hello Randy,

    The following approaches are available to achieve a similar to the desired scenario:

    1. Use Table items or other data items to represent detail information, instead of using SubReport items.
    2. Use Drillthrough report action pointing to the same report but passing different report parameters. Based on the passed report parameters you can hide/show report items, vary the report presentation and data.
    3. Use sub-reports, but embed them in the master report as XML. There are different report source types which can be used in conjunction with the SubReport item and you may find one that is more suitable for your scenario. For more details, please check the Report Sources help article.

    You may also find useful the Serializing Report Definition in XML help article, which contains examples on how to serialize/deserialize a report.

    Regards,
    Nasko
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top