Search code examples
sql-servervisual-studioreporting-servicessql-server-data-tools

SSDT Sub-report is incomplete


I am working on my first report designed in Visual Studio (2015) SQL Server Data Tools. My sub-report is only returning one record for each parent event though the sub-report's dataset is returning multiple records.

My Report: On-the-clock-report in design view

The linking value for the sub-report is the field [EmployeeWorkSessionID]

The Sub-report Breaks Sub-report in design view

The sub-report's dataset also contains the field [EmployeeWorkSessionID]

Sub-report preview #1 Sub-report for WorkSession 293

Run by itself this sub-report returns 2 records for WorkSession 293, including a Lunch still in progress.

Sub-report preview #2 Sub-report for WorkSession 288

Run by itself this sub-report returns 2 records for WorkSession 288, including a Lunch that is completed.

The (not so) complete report The full report preview

The preview of the full report shows the first record for each WorkSession, but none of the others. The EmployeeWorkSessionID's are associated with the correct Employee. The report space is large enough for three lines. The correct records are return by the datasets, they are just not displayed. The open lunch break (containing NULLs) is not the only record being skipped.

Any ideas?


Solution

  • This issue is caused because SSDT Report Designer caches the data collected the first time you preview the report and does not rerun the dataset queries on subsequent previews!

    Obviously some actions must cause it to renew the datasets because my report did change over the course on the days; but it did not change often enough to make it obvious what was happening. The solution below looked like it was working because moving the sub-report caused an update. But after that run the report data remained static while the database changed.

    Here is a tool to reset (delete) the cached data.

    And the stackoverflow article that saved (what's left of) my sanity.

    My report was working the whole time; Visual Studio was being lazy.

    If anyone knows of a way to force live data access for all previews I would love to know about it too.