Custom Viewer Report
For this example, we will build a report which displays a set of results based on a Sitecore Query with a custom viewer to display additional fields from your custom solution.
Requirements:
The report will display all items under the content path selected by the user. The report must also display the “Title” field in the report results in addition to the standard fields.
Let’s build it
Step 1: Open up the ASR source code project in Visual Studio. Find the ItemViewer class, then copy it to your solution in an appropriate library. You will need to reference the ASR and ASR.Reports DLLs.
Rename the viewer to “CustomItemViewer” for the purposes of this example.
Now we can add our custom field to the view by editing the “getColumnText” and “AvailableColumns” methods.
Step 2: Create a viewer item called “Custom Item Viewer” and configure as per the image. In the Viewer field click edit and add the new Title field to the list in the order you wish to display it in your report.
Step 3: Create a report item called “Custom Item Viewer Report” and configure as per the image.
Step 4: Run the ASR report and find your custom field displayed in the report results in the order you defined in the viewer.