Adding a Banner to a Report Header

June 22, 2010 Leave a comment

After you have created your own report color scheme you may want to add a graphic to appear in the report header.

In the Stimulsoft Windows Designer, you can add an image to the report header using the watermark property.

To add an image to a report header:

1. Select a suitable report and open it in the Report Designer. For example, Latest Human Sessions.

2. Select the page

3. In the ribbon, select the Page tab

4. Click Load Image to open the Image dialog box. Browse to an appropriate banner image and then click Close.

banner image dialog box

The banner is now visible in the report:

banner in report designer

5. Ensure that you have set the following properties in the Properties panel:

Report Element Property Setting
Page Watermark Enabled = True
Page Header Appearance, Brush Empty
Report Title Appearance, Brush Empty
  Border Component Style = None

6. Save your changes and preview the report.

You can now see the background image in the report header.

banner in header preview

To change the transparency of the image:

1. In the Report Designer ribbon, select the Page tab.

2. In the Watermark Image group click Image Transparency.

3. Move the slider control to change the transparency of the image.

4. Save your changes and preview the report.

Categories: Sitecore OMS reports

Changing Hyperlink States using CSS Styles

June 15, 2010 Leave a comment

In the report designer, it is easy to change common text styles to suit your chosen color scheme. However, changing hyperlinks states from the blue and purple used in the standard OMS reports is not as straight forward.

If you want to change the different states of a hyperlink, there is a workaround that allows you to do this by embedding CSS styles into a report header. This is an easy solution to the problem and can also be used for other purposes.

Create a Link Style Component

First create a new component style in the Style Designer called Link:

1. Open the Latest Human Sessions report.

2. Open the Style Designer.

3. Create a new component style called Link.

Link style

4. Set a different Text Brush color property that contrasts with other text used in this report, and then close the designer.

5. In the Latest Human Sessions report click on the text links that you want to change. If you want to select multiple links, hold down the SHIFT key while you make the selection.

6. Format these links by selecting the Link style in the Style panel.

7. In the ribbon, click Save.

Create a CSS Style

1. In the Latest Human Sessions report, drag a text box from the toolbox to the report header.

hyperlink text box

2. Double click on the text box to open the Expression Editor.

3. Copy the following CSS code into the Expression Editor:

{"<style type='text/css'>a { color:green } a:visited { color:red }</style>"}

Now every link formatted with the Link style will have the styles contained in this expression applied to them.

4. With the same text box selected, in the Properties panel set the Allow Html tags property to False.

If you do not set this property the changes you made to the hyperlink states may not be visible in the report.

5. In the ribbon, click Save and preview the report.

If you want to remove the underline state from a hyperlink:

1. Open the Expression Editor

2. Add the following expression:

a { text-decoration:none }

3. Save your report and preview your new link states in Sitecore Analytics.

Categories: Sitecore OMS reports

Step 4: Testing the Solution

June 14, 2010 Leave a comment

To test your solution:

1. Ensure that you have the appropriate version of the Sitecore CMS installed

2. Install the update package. Use the Update Installation Wizard tool.

3. Run smart publish.

4. Rebuild the training-master and training-web indexes with the RebuildDatabaseCrawlers script placed under /layouts/scripts.

rebuild search indexes

5. View the Office Products section of the site and select an item such as The Standard desk chair.

testing the standard

You can now see all items that are related to the currently selected item.

6. Enter a search term in the search box, such as Desk.

testing the desk search

In the Search Results page you can see the all the related items linked to the items found in the search and the categories and brand names related to these items (refinements).

You have now successfully used Lucene and Sitecore.Search to navigate a bidirectional relationships in Sitecore.

Categories: Lucene Search

Step 3: Create a Web Control to Display Related Items

June 14, 2010 Leave a comment

Next create a Web control class to display search results on your Web site. In this solution there are three Web controls:

  • RelatedItems.cs
  • SearchResults.cs
  • Facet.cs

In this blog post we will only create the first control, RelatedItems.cs and provide the code used to create the facet control.

How to Create a Related Items Web Control

 

RelatedItems.cs

The purpose of the related items control is to trigger a query that fetches content from the search indexes. It uses the Searcher and the Query Runner classes to return a list of items and then formats the list and displays the results as related items in the side bar of the appropriate product pages.

To create a related items control:

1. Include the following namespaces:

namespace Starterkit.WebControls

{

using System;

using System.Web.UI;

using Sitecore.Data.Items;

using Sitecore.Links;

using System.Collections.Generic;

using System.Linq;

using Sitecore.Data;

using Sitecore.Data.Fields;

using Sitecore.Diagnostics;

using Sitecore.Training.Index;

2. Name this Web control RelatedItems.

public class RelatedItems : Sitecore.Web.UI.WebControl

3. When you create a class that inherits from a Web control you always need a DoRender method. Create a DoRender method to control the presentation of the related items list. The following code extract shows the entire method.

protected override void DoRender(HtmlTextWriter output)

{

var categories = from relatedItem in GetAllRelations()

group relatedItem by GetDisplayNameById(relatedItem.ParentID) into g

select new { CategoryName = g.Key, Items = g };

if (categories.Count() > 0)

{

//<div id="relatedItems">

output.AddAttribute(HtmlTextWriterAttribute.Id, "relatedItems");

output.RenderBeginTag(HtmlTextWriterTag.Div);

//<h2>

output.RenderBeginTag(HtmlTextWriterTag.H2);

output.Write("Related Categories");

//</h2>

output.RenderEndTag();

//<ul>

output.RenderBeginTag(HtmlTextWriterTag.Ul);

foreach (var category in categories)

{

//<li>

output.RenderBeginTag(HtmlTextWriterTag.Li);

output.Write(String.Format("{0} ({1}):", category.CategoryName,

category.Items.Count()));

//</li>

output.RenderEndTag();

//<ul>

output.RenderBeginTag(HtmlTextWriterTag.Ul);

foreach (var item in category.Items)

{

//<li>

output.RenderBeginTag(HtmlTextWriterTag.Li);

//<a href='/item.aspx'

output.AddAttribute(HtmlTextWriterAttribute.Href,

LinkManager.GetItemUrl(item));

output.RenderBeginTag(HtmlTextWriterTag.A);

output.Write(item.DisplayName);

//</a>

output.RenderEndTag();

//</li>

output.RenderEndTag();

}

//</ul>

output.RenderEndTag();

}

//</ul>

output.RenderEndTag();

//</div>

output.RenderEndTag();

}

}

Create a method called GetAllRelations.

protected IEnumerable<Item> GetAllRelations()

This method goes to the multi-list field on the item and fetches all items that are marked as related by reading the value of the multi-list field.

It then creates an instance of the Searcher and calls the Searcher GetRelatedItems byField method which triggers the Searcher and Query Runner.

4. In the GetAllRelations method, use comments to select a Searcher method. Add or remove comments so that only one method can be run at any one time:

//relatedItems.AddRange(searcher.GetItemsByFullTextQuery(ItemIds));

relatedItems.AddRange(searcher.GetRelatedItemsByField(ItemIds, fieldName, true));

//relatedItems.AddRange(searcher.GetRelatedItems(ItemIds));

This enables you to easily change the way the control interacts with the Searcher.

5. Create a method called GetDirectItemRelations(string fieldName)

protected List<Item> GetDirectItemRelations(string fieldName)
        {
            var directItemRelations = new List<Item>();

            foreach (var itemId in ItemIds.Split(new[] { "|" }, 

            StringSplitOptions.RemoveEmptyEntries))
            {
                var item = Sitecore.Context.Database.GetItem(itemId);

                if (item != null &&
                    item.Fields[fieldName] != null &&
                    (FieldTypeManager.GetField(item.Fields[fieldName]) is MultilistField))
                {
                    MultilistField relatedItemsField = item.Fields[fieldName];
                    directItemRelations.AddRange(relatedItemsField.GetItems());
                }
            }

            return directItemRelations;
        }

            return directItemRelations;
        }

Get all related items and return a list of GUIDS that are pipe separated. Sitecore uses pipe separated lists in the Related Items field to separate GUIDS. In the Content Editor View tab, if you select the raw values field, you can see the pipe separated GUIDS in the RelatedItems field.

pipe separated guids

6. Create a method called GetDisplayNameById(ID itemId).

This method gets the title or display name for the selected item from the title field and displays it in the control.

standard related items  Related Items Web control

7. Save and compile your new Web control.

Facet.cs

This control adds the refinements that display Category and Brand Name above the related items control.

The Facet Web control fetches items from the Content Editor, content tree and then gets the URLs of each item. Then it constructs a query in the address bar of the browser.

For example:

http://<your site>/en/Standard-Items/Search-Results.aspx?search=desk

desk in address bar

Code extract to show how the refinements query is constructed:

{

string url = LinkManager.GetItemUrl(Sitecore.Context.Item);

var queryStringDictionary = WebUtil.ParseQueryString(WebUtil.GetQueryString());

if(queryStringDictionary.ContainsKey(FieldName))

queryStringDictionary.Remove(FieldName);

return WebUtil.AddQueryString(url + "?" + WebUtil.BuildQueryString(queryStringDictionary, false), new[] { FieldName, FieldValue });

}

AppendFacetURL is called by the following code that controls the presentation of the refinements:

{

//<div id="relatedItems">

output.AddAttribute(HtmlTextWriterAttribute.Class, "facet");

output.RenderBeginTag(HtmlTextWriterTag.Div);

//<a href='/item.aspx'

output.AddAttribute(HtmlTextWriterAttribute.Href, AppendFacetUrl());

output.RenderBeginTag(HtmlTextWriterTag.A);

output.Write(Name);

//</a>

output.RenderEndTag();

//</div>

output.RenderEndTag();

}

search results control  Search Results control with facetted list control

Search Results.cs

The Search Results Web control uses the same classes as RelatedItems.cs to display related items and other refinements in the side bar. See the full solution source code to find out how this control has been adapted to display the same related items and facetted list in the side bar.

search results control related items  Search Results control with related items control

Next step: Testing the Solution

Categories: Lucene Search

Step 2: Implement a Query Runner Class

June 14, 2010 Leave a comment

Searcher contains a list of all query methods available to interrogate the search indexes. Query Runner contains the processing logic for each query.    

For every method run in Searcher.cs, Query Runner is called behind the scenes. To see how each query is constructed look in QueryRunner.cs. This is also where each query is run.    

QueryRunner.cs

To create a query runner:    

1. First add the following namespaces:    

namespace Sitecore.Training.Index

{

#region Usings

using System;

using System.Collections.Generic;

using System.Linq;

using Lucene.Net.Search;

using Lucene.Net.Index;

using Lucene.Net.QueryParsers;

using Lucene.Net.Analysis.Standard;

using Search;

using Diagnostics;

using Data;

using Collections;

 

2. Name the class Query Runner    

public class QueryRunner : IDisposable

    

3. Create the following constructor:    

public QueryRunner(string indexId)

{

Index = SearchManager.GetIndex(indexId);

}

    

This constructor gets the appropriate search index. It calls the SearchManager class with the GetIndex method and uses index as a parameter. The IndexId parameter can refer to either the training master or training web indexes.    

4. Create a property called index:    

public Index Index { get; set; }

    

5. Create two query runner methods. Both of these use the same parameter called query but the type is different.    

QueryBase = Sitecore.Search    

Query = Lucene.Net

Query Method     Description    
SearchResultCollection RunQuery(QueryBase query)     Using Sitecore.Search API – this method expects Sitecore queries    
SearchResultCollection RunQuery(Query query)     Using Lucene.Net API – this method expects Lucene queries    

5. Create your search methods (queries). These are the same as the methods listed in Searcher.cs. The table below describes each of these methods in more detail. View the Visual Studio solution to see the full source code for each method.

Method     Description    
GetItemsByFullTextQuery(string query)     Searches through all the text contained in the item fields, including Rich Text fields and meta-data.    
GetRelatedItemsByMultipleFields(string query, SafeDictionary<string> refinements)     Called from the SearchManager.Search() method via Searcher.GetRelatedItemsByMultipleFields:    Get the refinements from the query string:    var refinements =    WebUtil.ParseQueryString(WebUtil.GetQueryString());    

refinements.Remove(“search”);    

Pass them on to the searcher:    

var results =    

searcher.GetRelatedItemsByMultipleFields(searchString, refinements);    

This method links to a list of dictionary refinements and adds category and brand as refinements to the search.    

GetRelatedItems(string ids)     Gets all relations without specifying a field.    Get related items by list of Ids and returns a pipe separated list of ids.    
GetRelatedItemsByField(string ids,string fieldName, bool partial)     Extends the GetRelatedItems method by adding more parameters. This method can be used effectively to return items in bidirectional relationships.    
ContainsItemsByFields(string ids,    string fieldName, string fieldValue)     For refinements to work – to check if a category relates to any of the items returned in the search results.    

6. Define the following Clause Construction Helper classes:    

AddFieldValueClause(BooleanQuery query, string fieldName, string fieldValue, BooleanClause.Occur occurance)

    

AddPartialFieldValueClause(BooleanQuery query, string fieldName, string fieldValue)

    

AddFullTextClause(BooleanQuery query, string searchText)

    

ApplyIdFilter(BooleanQuery query, string fieldName, string filter)

    

ApplyRelationFilter(BooleanQuery query, string ids)

    

The Helper classes perform some extra validation on GUIDs before allowing them to be used by the search indexes. All GUIDs are first converted to lowercase and then given short IDs. Lucene also checks for and filters out any stop words. It is necessary to normalize GUIDs in this way to avoid unexpected results when querying.    

7. Return a search index specified by ID.    

public static Sitecore.Search.Index GetIndex(string indexId)

{

return SearchManager.GetIndex(indexId);

}

    

Next Step: Creating a Web Control to Display Related Items    

Categories: Lucene Search

Step 1: Implement a Searcher Class

June 14, 2010 1 comment

When you have completed this bidirectional example, if you view an office product or conduct a search of office products, a rendering control is displayed that shows all related items in the side bar of the page.

standard related items

The Searcher and the Query Runner make this possible by invoking a database crawler to search the indexes for any related items, depending on which Web control is used. The Web control then processes the results and displays them on the Web site.

Searcher.cs contains multiple methods that query the indexes in several different ways. The full code for each method is contained in the Query Runner; it is not visible in the Searcher. The Searcher simply contains a list of methods used.

The Searcher can only execute one method at a time. When a method in the Searcher is invoked by the Related Items Web control, the Runner is called. The Runner searches the indexes and sends a list of items to the Searcher used by the Related Items Web control to display related items to the site visitor.

Searcher.cs

To create a Searcher:

1. First include the following namespaces:

namespace Sitecore.Training.Index

{

using System;

using System.Collections.Generic;

using Search;

using Data;

using Data.Items;

using Collections;

2. Name the class Searcher: public class Searcher

3. Create a new instance of the Query Runner property to be used by the Searcher.

protected QueryRunner Runner { get; set; }

4. Create two constructors that are triggered when you run the Searcher. Only one of these constructors should accept parameters to specify which index is used when you conduct a search.

Constructors Parameters
public Searcher(){Runner = new QueryRunner(Constants.Index.Name);

}

() No parametersNo index id specified, so the query runner tries to find the index by calling index.name
public Searcher(string indexId){Runner = new QueryRunner(indexId);

}

(string indexId) is specified as the parameter to use to fetch the search index.

5. Define a new region in the code for search methods and then add each method that you want to use. Each search method is basically a query. This example shows the first method in Searcher.cs: GetItemsByFullTextQuery

#region Searching Methods

public virtual List<Item> GetItemsByFullTextQuery(string query)

{

var results = new List<SearchResult>(Runner.GetItemsByFullTextQuery(query));

return GetItemsFromSearchResult(results);

}

Search methods are only triggered when the Related Items control calls one. When a search method is called a new instance of the Query Runner is created in the Searcher. The new instance is called Runner.

var results = new List<SearchResult>(Runner.GetItemsByFullTextQuery(query));

Runner then searches the indexes and sends back all relevant search results to the method.

return GetItemsFromSearchResult(results);

The search results list returned to the Searcher is converted by the GetItemsFromSearchResult method into a result set containing items. This method iterates through the list of results and finds the url for each item.

It takes the search results extracted from the index and then stores them in a resultingSet list.

6. Next create a GetItemsFromSearchResult method. In this method the set of items stored in the resultingSet list is returned with the corresponding url so that you can click a link to get the item.

public static List<Item> GetItemsFromSearchResult(IList<SearchResult> searchResults)

{

var resultingSet = new List<Item>();

foreach (var result in searchResults)

{

var uriField = result.Document.GetField("_url");

if (uriField != null && !String.IsNullOrEmpty(uriField.StringValue()))

{

var itemUri = new ItemUri(uriField.StringValue());

resultingSet.Add(Context.Database.GetItem(new DataUri(itemUri)));

}

}

return resultingSet;

}

Methods and Parameters in the Searcher Class

Searcher Methods Parameters
GetItemsByFullTextQuery(string query) - full text query on a string
GetRelatedItemsByMultipleFields(string query, SafeDictionary<string> refinements) - full text query on a string- the second parameter searches for refinements using SafeDictionary, then creates a list of dictionary refinements – brand = IKEA, Category = Desk etc
GetRelatedItems(string ids) – Ids = returns the Ids of all items
GetRelatedItemsByField(string ids, string fieldName, bool partial) - Ids = Id of the product selected in the Related Items field. For example, the ‘Standard’ product.- fieldname – the related items field name- partial = boolean
ContainsItemsByFields(string ids, string fieldName, string fieldValue) - Applies an ID filter- fieldName,- string fieldValue = Brand e.g. IKEA
GetItemsFromSearchResult(IList<SearchResult> searchResults) - Search result list – for each item in the search result list this method gets the url and creates another list called resultingSet.

Next Step: Implementing a Query Runner Class

Categories: Lucene Search

Lucene Search and Bidirectional Relationships

June 14, 2010 4 comments

Introduction

The term bidirectional refers to navigating the one to many relationships that are common in relational databases. Sitecore often has difficulty finding content items in both directions in a bidirectional relationship, particularly when it has to find a large number of items.

In Sitecore there are currently three possible ways to solve the problem of bidirectional relationships:

  • Links Database
  • Sitecore queries
  • Lucene Search

Lucene Search is by far the most efficient way to handle bidirectional relationships in Sitecore. It can quickly find items in relationships where there are a large number of items without having a significant effect on performance. Ivan Sharamok wrote an interesting blog on the most efficient ways to extract data from Sitecore:  Working with Lucene Search Index in Sitecore 6.

Sitecore implements a wrapper for Lucene called Sitecore.Search which encapsulates the search functionality in Lucene.

Some of the benefits of using the Sitecore.Search API:

  • Closely integrated with Sitecore
  • Safe and more secure to use
  • Enforces good programming practices
  • Contains classes specifically related to search

Blog Objectives

  • To provide Sitecore customers and partners with a starting point when attempting to tackle the problem of bidirectional relationships
  • To explain the functionality of the main classes used in the bidirectional shared source module
  • To introduce the Sitecore.Search API and to give practical examples of how it can be used to solve a common problem

Prerequisites

  • Sitecore CMS 6.0 or later
  • Sitecore Starter Kit – Training Sample Site
  • Microsoft Visual Studio 2010

Solution Components

The bidirectional example described in this blog is also available as a shared source module. The module consists of a Sitecore update package and a Visual Studio solution.

Click here to download the module: Bidirectional Shared Source Module

The Visual Studio Solution includes:

solution in visual studio
The update package includes:

  • RelatedItems.cs – Web control that adds related items to selected product pages.
  • SearchResults.cs – This includes an update to the existing Search Results Web control to include related items and refinements in the search results.
  • Facet.cs – The facet Web control that adds refinements to the search results.
  • Facet items for Brand Name and Category added to the Meta-Data folder in the content tree:

facet items

  • The package adds a new field called Brand to the Product Category template:

brand field template

This blog does not cover how to create all the component parts of this solution. I aim to focus on the more complex components such as the Searcher and the Query Runner (Searcher.cs and Query Runner.cs) and will break the code in these classes down into smaller chunks. It is in these classes that you can see the Sitecore.Search API being used to solve the problem of bidirectional relationships.

The example in this blog is just one solution and there are many other ways to solve the same problem. For example, in your own solution you may want to create your own Database Crawler or create your own config include file settings. The settings contained in these files can vary greatly from one solution to another and it is possible to use the Sitecore.Search API to create your own crawler and config include files.

Steps

To create this solution, first download the shared source module and then follow these steps:

1. Implement a Searcher Class

2. Implement a Query Runner Class

3. Create a Rendering Control

4. Create a Facet Control

Next step: Implement a Searcher Class

Categories: Lucene Search

Changing Report Styles using the Properties Panel

June 7, 2010 1 comment

In the Stimulsoft Report Designer (Web or Windows versions) some presentation settings and styles can only be changed using the properties panel.

These include:

  • Changing background color of a report – Appearance, Brush, Color
  • Positioning report elements – Position controls the positioning of report components
  • Adding hyperlinks – Behavior, Interaction, Hyperlink
  • Embedding HTML tags – Text Additional, Allow HTML tags – allows HTML to be embedded in the report
  • Behavior – settings such as Print on all Pages or Printable = True. Some report elements are not displayed unless these properties are set correctly.

Two quick examples of how to use report properties:

    Changing the Report Background Color

    1. Select a report such as Latest Human Sessions.

    select page
    2. Select the report page. To select the page, click the white border around the edge of the report.
    3. With the page selected, open the Properties panel and expand Brush.
    background color property
    4. Select a color from the drop-down menu. For example, Light Grey.
    report color changed
    5. Save your changes and preview the report.

Note

If the background color is still not visible check the Border property of the report.

If the border property is set to None, then the background color will not be visible when you preview the report.

border setting

Apply a border to at least one side of the report.

background-border property

Click OK and preview your report again. You should now see the background color that you selected.

Using the Position Property

1. In the Latest Human Sessions report, select a text element, for example the timestamp in the report header.

position property

2. Open another report that uses the same text element, such as Leads Executive.

3. If you want the timestamp control to be positioned in the same in both reports, then check the position property.

4. Select a text element and enter a value in one or more of the position properties.

5. Save your changes and preview the report in Sitecore Analytics.

The Position property can be very useful if you want to have precise control over the positioning of text, links and images.

Next post: Changing Hyperlink States using CSS Styles

Categories: Sitecore OMS reports

Creating and Re-using Styles

May 27, 2010 1 comment

To illustrate how to create styles in an OMS report we will change the heading in the Latest Human Sessions Report in Sitecore Analytics.

Latest Human Sessions example

Important
Open the Latest Sessions.mrt file in the report designer. Remember that Latest Human Sessions is the base report for all the following reports: Latest Human Sessions, Latest Company Sessions, Latest ISP Sessions and Unidentified Sessions

If you change the style in any of these reports you will change the styles for all these reports. Therefore it is good practice to first make a copy of the report file and save it to your own folder. This prevents you from over writing other reports.

How to Create a New Style

In the Style Designer, there are three different styles to choose from:

  • Component Style
  • Chart Style
  • Cross Tab Style

To create a new style to format the report header title:

1. Click Add Style and then select Component. You can use component styles to format reports that contain mainly text.

types of stryles

2. In the Name field, enter MyStyle1 or a name of your choice.

my style 1

3. Expand Text Brush and select the color Dark Grey.

4. Expand Brush and select the color Light Grey. This changes the background color behind the heading.

5. Expand Font, select Font Size and enter the value 21.

6. In the Style Designer, click Close.

7. In your chosen report, select the report header.

8. In the Report Designer ribbon Style panel, select the style you just created.

applying a style

9. In Sitecore Analytics, refresh the Latest Human Sessions report and view the new in the report header.

component style preview

You have now created and applied a new component style to a report.

Saving and Re-using Styles

Save Stimulsoft styles as a .sts file.

How to Save Styles

1. Open the Style Designer.

2. Click Save Style

Save style

3. In the Save Style dialog box, you can see any existing style files.

save styles dialog box

4. Give your style a name such as MyStyles and click Save.

my styles

You can see MyStyles added to the list of available styles.

How to Import Styles into another Report

1. Open a report, such as Metrics.

2. Open the Style Designer.

3. Click Open Style.

open style

4. Select the style you want to open from the Open Style dialog box, for example MyStyles.

open style dialog

Note
If the styles contained in the .sts file have the same names as in the existing report, they will automatically overwrite all the styles contained in that report. If the component style names are different, you must apply each style manually to the elements in the report that you want to change.

Next post: Changing Report Styles using the Properties Panel

Categories: Sitecore OMS reports

Styling OMS Reports

May 27, 2010 Leave a comment

Introduction

If you want to change the look and feel of the standard OMS reports, there are several things you can do.

human sessions example

You can use the Reports.Web Designer to make changes to text, color, and font style. However, there are some formatting tasks that are a little more difficult to achieve. For example, changing the colors associated with the different states of a hyperlink, changing the colors in a chart or knowing how to create a style sheet that you can re-use in multiple reports.

In this series of blogs I will explain how to achieve some of these tasks. There is also existing Stimulsoft and Sitecore documentation that covers the basics:

  • The Report Designer Cookbook – available on the Sitecore Developers Network in the OMS section
  • Stimulsoft User Manual – available for download from the Stimulsoft Web site – http://www.stimulsoft.com/Documentation.aspx

Tools available that you can use for designing OMS reports:

  • Stimulsoft Reports.Web Designer – Flash based designer available in each report. This is built into Sitecore Analytics and is a standard part of the OMS.
  • Stimulsoft Windows Designer – This is a Windows application. Download the free demo from Stimulsoft Web site and install it on your computer. http://www.stimulsoft.com/downloads.aspx

Note
If you install the Stimulsoft Windows Designer ensure that you are using the correct version. Sitecore currently uses version 2009.1.400. If you use a more recent version of the report designer some properties may not render in Sitecore Analytics.

The Stimulsoft Style Designer

The Stimulsoft Report Designer Style Designer is the main tool you will use when working with report styles. The Style Designer allows you to create component, chart and cross tab styles and these work a bit like Microsoft Word styles. To apply a style you simply select the text element that you want to change and then in the Style group, click on the style that you want to use.

style designer window 

Each report has its own set of styles which are contained in a styles .sts file. This file can be found in the same Web site folder as the report definition .mrt files.

wwwroot\<website_name>\WebSite\sitecore\shell\Applications\Analytics\Reports\Styles.sts

Advantages of the Style Designer

  • Quick and easy to create and reuse styles
  • You can easily create styles for charts
  • HTML and CSS style tags can be embedded into reports

Limitations of the Style Designer

  • You cannot control all styles with the Style Designer. You must use the properties panel to control some style settings such as page background color.
  • You cannot create a single style file to apply to all reports. If you have saved a style file and want to use it in more than one report, you must import it manually into each report.
  • CSS style sheets are not supported, although you can embed CSS style tags in the report header. You cannot create a CSS style sheet and link to it from all reports. You must use Stimulsoft styles.

Stimulsoft Style Files

Each report has a Stimulsoft style sheet associated with it. Stimulsoft styles are defined in an XML file that cannot be edited. You should only change the contents of an .sts file using the interface in the Style Designer.

Extract from Styles.sts showing one of the styles defined on odd and even rows:

extract from style xml file 

Each report definition file (mrt file) contains a copy of the style XML code in the source code. Therefore it is not possible or desirable to change the contents of the .sts and change the format of all reports.

You cannot use Stimulsoft styles in the same way as cascading style sheets. If you change a style which is used across multiple reports you can only update elements in the report that you are working on. To import a style file (.sts file) into another report use the Style Designer, Open Style button to find the saved style file then click Open to import it into the report.

Next post: Creating and Re-using Styles

Categories: Sitecore OMS reports
Follow

Get every new post delivered to your Inbox.