Written by Thomas Harlan, Reporting Services Team - iatricSystems
On occasion there is a need for rows on a report to be conditionally hidden or visible based upon an expression that is determined when the report is run. One example of this type of functionality can be shown within a report displaying the assessments for a patient. Each of the assessments can have a set of questions attached.
Because a patient may have multiple assessments, the user requires the ability to display or hide the questions for any assessment. For instance, if there is only one assessment, the user would like for the questions to be displayed automatically.
For the example report, the MainDs dataset was created as seen below.
The dataset has two identifier (ID) columns, bcr_id and QuestionID, that define a specific assessment, bcr_id, and each question within the assessment.
On the canvas of the report, a table was created and linked to the MainDs dataset. Within the table a parent group was created, on the Details group, based on the field bcr_id. When the parent group was created, the add header and footer option was selected to add spacing between the groups.
Showing all rows initially can make for an overly busy presentation, when there are several assessments done on a patient; and hiding the detail if only one assessment exists is rather extreme.For the ability to dynamically display or hide the detail, a few additional steps are required.
= CountDistinct(Fields!bcr_id.Value, “MainDs”)
Note that the following steps were followed for each of the rows (Question, detail, and group footer).
In this window the initial visibility can be set and the ability to define a cell that will allow the group to be expanded/collapsed at runtime. The toggle shows a [+] or [-] icon in the cell to toggle the visibility. By selecting the Show or Hide option determines whether the row is visible initially.
= IIF(Variables!GroupCount.Value = 1, False, True)
Now that the rows dynamic visibility has been set, the appropriate icon [+] or [-] needs to be set depending on whether the detail is visible when the report is run.
= IIF(Variables!GroupCount.Value = 1, True, False)
Below is a preview for multiple assessments.
Below is a preview for a single assessment.
As ever, if you need help with MEDITECH DR optimization, reporting, extract, index creation or analysis please feel free to give your iatricSystems Account Executive a call!