Custom Reports

The data used in reports resides in the project database. Every Clarity project has a designated database. You can see the database name, or purge the data and start over on the Edit Project pane. The data is generated by the Revit DB Export task, which runs against Revit models and populates the project database. Each report of the project data is defined by an XML file, which determines what information displays, how it is presented, and what options a user of the report has.

Report Files Location

By default, Clarity provides 9 template reports in every project. The templates are stored in the C:\Inetpub\wwwroot\CentralAdministrator\ReportTemplates folder. When creating a project, Clarity assigns it a GUID (globally unqiue identifier) that looks like 74d8e70f-695a-47e8-9953-7efb01b8ae77. Then, Clarity creates a subfolder under the C:\Program Files\IMAGINiT Technologies\Clarity Central Administrator\ReportConfigs folder and copies all of the report templates to it. If you browse to your project in Clarity, you can see the GUID for the project in the URL (address) for each page.

For example: http://(myServerName)/CentralAdministrator/Project/Main/94984e3e-c101-4f67-890c-636cf44faf5e

Report XML File Structure

The file has a variety of sections:

The Select Columns SectionThe Select Columns Section

Sample Section:

<SelectColumns>
  <Column groupIndex="1">FamilyName</Column>
  <Column groupIndex="2">TypeName</Column>
  <Column>Level</Column>
  <Column>Manufacturer</Column>
  <Column>Model</Column><Column summary="Count">Mark</Column>
  <Column>WallName</Column>
  <Column visibleOnGridLoad="false">URL</Column>
  <Column visibleOnGridLoad="false">FireRating</Column>
</SelectColumns>

 

In the SelectColumns section, there is one column entry for each field that you would like to show in the report. Primarily, the value of the Column entry will be the name of the field (as it exists in the source table or view). Typically, the field name matches the name of the Revit parameter in question (with a few obscure exceptions). There are additional optional attributes that you can specify for any column:

<Column groupIndex="1">FamilyName</Column>

<Column groupIndex="2">TypeName</Column>

This indicates that the column FamilyName is to be grouped first, and the TypeName second.

The SourceTable sectionThe SourceTable section

The SourceTable could be straightforward or tricky, depending on the data you want to display. Tables in the database are mostly organized by category, type, or instance.

 

To help with this process, and to see the tables that exist, and their field names, use the Microsoft SQL Server Management Studio application installed with Clarity.

The DropDown sectionThe DropDown section

Drop-down filters enables you to easily control which parts of the data displays.

 

Sample section:

<DropDowns>

     <DropDown name="Phase" default="Select" displayField="Name"
       valueField="Name">Select * From PhasesWithRooms Order By SequenceNumber</DropDown>

     <DropDown name="Level" default="Select" displayField="Name"               
      
 valueField="Name">Select * From Levels Order By Elevation</DropDown>

</DropDowns>

 

Each DropDown corresponds to a form element shown to the user at the top of the report. They each have the following required elements:


The main value of the DropDown element is an SQL query against the project database (i.e. Select * from Level - for all the level names, select against a view, control the order, etc.)

The WhereCondition sectionThe WhereCondition section

The WhereCondition entry defines how a given dropdown will affect the main query of the report.


Sample section:

   <WhereConditions>

      <WhereCondition type="AND" sourceDropDown="Phase">Phase</WhereCondition>

      <WhereCondition type="AND" sourceDropDown="Level">Level</WhereCondition>

    </WhereConditions>

 

Each WhereCondition contains several required attributes:

 

The main value of the WhereCondition is the name of the field in the SourceTable that will be filtered by this DropDown.


The purpose of using WhereConditions and DropDowns is to build a SQL query against the table or view selected. In the above example, if the user selected New Construction and Level 1, the resulting query of the database would be:

SELECT * FROM RoomFinishes WHERE Phase=’New Construction’ AND Level=’Level 1”

This filters the rooms to just those that matched the criteria.

The GridSettings SectionThe GridSettings Section

The GridSettings section enables you to control the look, feel, and a few behaviors of the report.

 

The following elements control the GridSettings:

Other Notes

The parameter values in the database are typically stored in Revit internal units. For example, for length parameters, the values will be in decimal feet. In order to present other units, it may be necessary to build a conversion into a view.