Time remains very little. From day to day we will release version 2015.1 of Stimulsoft Reports. And while our departments are putting the finishing touches, we will reveal to you the secrets of the StiMvcViewer component. In the release 2015.1, this component will support interactive reports. Now you can easily create reports with collapsing and interactive sorting.

Collapsing is an opportunity to roll up and roll out, for example, groups directly in the rendered report. For example, if you have a report with groups, it usually displays the title of the group, and then the data by this group. In the case with collapsing the group title will be displayed and these groups can expand or collapse. Look closely at the picture below.

MVC Viewer

Interactive sorting means the ability to sort data in the rendered report. In other words, select the text component, assign a data column to it (by which sorting will be done) and render the report. When you click on this text component in the rendered report its content will be sorted. Each clicking on this component changes the sorting direction (ascending or descending order). It should be noted that the data column is used in the text component and the data column specified for the interactive sorting may vary. See an example below.

MVC Viewer

For full evolution we need two more steps. Therefore, in addition to all of the above, it is also possible to create drill down reports and reports with bookmarks.

Bookmarks can be found on a separate panel and used to quickly navigate through the report. For example, if a report is created with groups, the bookmarks are usually formed by the group name. This helps you to quickly jump to a specific group.

Drill down is a certain type of data connection. For example, there is a list of categories with descriptions and images. The drill-down reports have interactivity that is represented by showing the content when you click on any category (for example, a list of products). Below is an example of a drill down report.

MVC Viewer

By the way, creating interactive reports can be found in the documentation and our video tutorials. Leave your comments and questions here and we will answer you with pleasure.
Time is running very fast, and there is a couple of weeks before the release of the new version 2015.1. Meanwhile, the development and improvement of components is not stopping even for a minute. And now it is safe to tell you about adding new features in StiMvcViewer that is a part of Stimulsoft Reports.Web. One of the most anticipated features is that in the nearest release, the new Viewer for MVC will support more than 15 color themes of the user interface. This will give you the opportunity to choose color preferences which are the most pleasant to you and matching your requirements. Here are a few of the themes on the picture below.

MvcViewer Themes
For us, constant improvement of products is not just moving forward. This is primarily, understanding of our own mistakes, correcting them, implementing new technologies and optimizing the existing things. In the official release 2015.1 one of the components that will make you happy will be the report viewer – StiMvcViewer. This component is a part of Stimulsoft Reports.Web.

We have optimized and grouped properties, added new controls, partially redesigned the user interface. Expanded support for the UI themes, and subsequently it will be possible to add and custom themes. The most striking possibility of a new viewer will be support for the touch interface. The viewer for MVC will be run on mobile devices.

MVC Viewer
StiMobileDesigner is an ASP.NET component for creating and editing reports in a web browser. In this article we will describe how to use this component in the cloud platform Azure.

First of all, it should be noted that the component StiMobileDesigner is based on the client-server technology. The cache is on the server side which means the cell for storing information with quick access. You can get any desired object from the cache or alternatively upload it to the cache. But if you load the report designer on Azure, then the stored version of an object can be saved in different server instances. Therefore, when saving the report to various server instances the problem occurs with its storage in the cache. In order to work correctly, it is necessary that the report is saved in the same cache.

To solve this problem we have created a class StiCacheHelper for each of the following components – StiMvcMobileDesigner, StiMvcMobileViewer, StiMobileDesigner, StiMobileViewer and allow the user to override the methods SaveObjectToCache and GetObjectFromCache. In these methods you can describe its own saving in the cache and removal of the object from the cache. In other words, you need to override the method and store any objects in its own cache, which greatly simplifies and speeds up work with reports on Azure. 

class StiAzureCacheHelper : StiMobileViewer.StiCacheHelper
{
    string SlsPath = RoleEnvironment.GetLocalResource("TestStorage").RootPath + "\\";
    public override void SaveObjectToCache(object obj, string guid)
    {
        byte[] cacheData = GetCacheDataFromObject(obj);
        System.IO.File.WriteAllBytes(SlsPath + guid, cacheData);
    }
    public override object GetObjectFromCache(string guid)
    {
        if (!System.IO.File.Exists(SlsPath + guid)) return null;
        byte[] cacheData = System.IO.File.ReadAllBytes(SlsPath + guid);
        return GetObjectFromCacheData(cacheData);
    }
}
StiMobileViewer1.CacheHelper = new StiAzureCacheHelper();
Using the SQL queries helps avoiding the data duplication in the tables and provides maximum flexibility when searching and showing the data in a database. This also allows requesting only required data, fields, registers etc.

One of the ways to get only required data is using parameters. When you create a query you can use Parameter. It is used to pass additional information into the query for selecting data. For example, you can create a query with parameters when it is required to use some values in the query during every execution of this query. The object Parameter can be used only together with SQL data sources.

More information about it can you read in our documentation.

Also you can create parameters from the code:

Dynamic SQL
Working with parameters in Stimulsoft Reports software is similar to the parameters in the .NET Framework.

Using variables in parameters

In Stimulsoft Reports you can use Variables in the report. The Variable provides an ability of placing and using a variable when creating reports. The variables can be of different types such as string, date, time, array, collection, range etc. All variables are stored in the data dictionary. Before you will use any variable, you should add it to the data dictionary. More information about this can be found in our documentation.

Variable in Parameter

Values to variables can be set from code or by request from the user. There are two ways how to do this from code. It depends on with which report (compiled or not) the user works.

before compilation:

Variable in SQL
after compilation:

Variable in SQL
When you request the value of the variable from the user, you should set the parameters on the panel Request from user. These parameters determine possible involvement of the user when applying a variable in the report. Possible values of variables the user can get from the data source, specifying it in the Data Source property. For correct work of this functionality you should get data for all data sources, and then request the selection of the values for variables from the user. If possible values are not taken from the data sources and values selected by a user are used in queries, then, in order to avoid requesting all the data once again, it makes sense to set the Request Parameters property of the report to true.

In our reporting tools you can use the variables directly in the query. The value of the variable will be inserted into the query directly before its execution without some additional actions. For example, when the query is:

Query Type
and a value of the variable is Chocolate, then in this case the next query will be executed:

Variable Chocolate
Naturally, this query will not be executed. The correct query is the next one:

Query Type
You can find this feature only when working with strings, but this behavior allows creating more difficult queries dynamically in contrast to values of variables. The similar example is shown below.

Using variables to output lists

From time to time you need to create more complex queries. For example, when, on one hand, you need to get data from the data source to give a choice for a user, and on the other hand, some queries may not be executed, because the required parameters are not set. In this case we a have a problem.

One of such examples. The variable with enabled option Request from user can be used both for selecting several values and in the operator IN of the SQL query.

You need to know one thing. By default the variables of the type List are filled only after connection of the dictionary to data sources. Therefore, during the first connection of data source this variable will be empty, and the expression Variable1.ToQueryString() throws an empty string and, accordingly, the entire query throws the error. To avoid this we have added an additional check.

Check
In this example all data will be shown and after you click the button Submit the report will be rebuilt using only selected data.

When you need to view only required data, you should do the following:

1. Set the report property report.RequestParameters to true. And, before the first click of the button Submit, only the empty report page will be viewed and rendering will begin after the click.
2. At once initialize the report variable with additional values.

Required Data