none
Subreport works in unit test but gives error from web app RRS feed

  • Question

  • Hi. I have a Visual Studio 2017 solution with multiple projects. One project is a class library that returns a byte array PDF from a local RDLC report. The main report contains a subreport "Route" with a Tablix; in the last row of this Tablix is a subreport "RailroadCrossings". This row subreport in turn contains a Tablix, which uses a parameter "RouteId" from its parent to filter its dataset. So here's the structure:

      - Main report
         - "Route" subreport (has a parameter defined on it called "RouteId")
            - Tablix 
                - "RailroadCrossings" subreport which has parameter "RouteId"
                   - Tablix showing railroad crossings for this route

    When I run the report from my unit test, all works fine and I get the railroad crossings. When I run it from the MVC app, it puts this into the row for the railroadcrossings of the Route report:

    The subreport 'RailroadCrossings' could not be found at the specified location
    Renderer.Templates.Subreports.RailroadCrossings.rdlc. Please verify that the subreport has been published and that the name is correct.

    In Visual Studio, here is how I have structured the files:

      - Renderer (root)
         - Renderer.cs
         - Templates (folder)
            - MainReport.rdlc
            - Subreports (folder)
               - Route.rdlc
               - RailroadCrossings.rdlc

    I've stepped through the code in the "SubreportProcessing" event handler, and viewed e.ReportPath. It's never showing "RailroadCrossings" but shows "Route" when called from the web. On the RailroadCrossings subreport properties, in the field "Use this report as a subreport", it's got "Renderer.Templates.Subreports.RailroadCrossings". 

    In both cases (unit test and web), I'm calling with identical arguments. Any ideas what could be happening? 

    Wednesday, March 13, 2019 12:02 PM

Answers

  • Thanks, Eric Liu. I fixed the issue by eliminating the nested subreport and flattening the data. Then sprinkled it with some HTML bold and paragraph tags. Now it's showing the railroad crossings as a "list" -- which is actually just a string property off an object. 

    • Proposed as answer by Mitarai Queen Monday, March 18, 2019 1:20 AM
    • Marked as answer by arc_dev Monday, March 18, 2019 10:54 AM
    Thursday, March 14, 2019 2:33 PM

All replies

  • Hi arc_dev

    According to your description ,you could check in the following aspects.

    • Try to clean and rebuild your project . run the project in mvc app first and then run in unit test next check if there exist any error or not .
    • Try to delete the .rdl.dat file in the project path ,and then run the project again , check if there exist any error or not .

    Seems the thread are more related to the visual studio report control forum, you could post your issue on that forum.

    Reference : Error 'the subreport could not be found at the specified location. Please verify that the subreport has been published and that the name is correct'

    From C# when calling SSRS report only main report shows data sub report giving error

    Thanks for your support and understanding.

    Best Regards,

    Eric Liu


    Best Regards, Eric Liu MSDN Community Support Please remember to click Mark as Answer if the responses that resolved your issue, and to click Unmark as Answer if not. This can be beneficial to other community members reading this thread.

    Thursday, March 14, 2019 5:55 AM
  • Thanks, Eric Liu. I fixed the issue by eliminating the nested subreport and flattening the data. Then sprinkled it with some HTML bold and paragraph tags. Now it's showing the railroad crossings as a "list" -- which is actually just a string property off an object. 

    • Proposed as answer by Mitarai Queen Monday, March 18, 2019 1:20 AM
    • Marked as answer by arc_dev Monday, March 18, 2019 10:54 AM
    Thursday, March 14, 2019 2:33 PM
  • Hi arc_dev

    Glad to hear that you have solved your issue , if possible you could mark the appreciated reply or share your solution as answer here ,so that other members in this forum could get help from it.

    Thanks for your support and understanding.

    Best Regards,

    Eric Liu


    Best Regards, Eric Liu MSDN Community Support Please remember to click Mark as Answer if the responses that resolved your issue, and to click Unmark as Answer if not. This can be beneficial to other community members reading this thread.

    Monday, March 18, 2019 1:20 AM