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.

ASRpart8

ASRpart9.png

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.

ASRpart10.png

Step 3: Create a report item called “Custom Item Viewer Report” and configure as per the image.

ASRpart11.png

Step 4: Run the ASR report and find your custom field displayed in the report results in the order you defined in the viewer.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s