如何创建和配置SQL Server移动报表
Microsoft has recently launched SQL Server 2016 with lots of new features like row level security, always encrypted, stretch database, PolyBase, R Services, hybrid cloud capabilities, Dynamic Data Masking, query store, etc. There is a rich set of business intelligence, security features, and high availability solutions.
Microsoft最近发布了SQL Server 2016,具有许多新功能,例如行级安全性,始终加密,拉伸数据库,PolyBase,R Services,混合云功能,动态数据屏蔽,查询存储等。其中有丰富的商业智能,安全功能和高可用性解决方案。
There were no major enhancements to SSRS in previous versions of SQL Server. With the release of SQL Server 2016 though, there are many new features in SSRS, along with a change in existing reporting layouts. Some of the important changes in SSRS are:
在早期版本SQL Server中,SSRS没有重大增强。 但是,随着SQL Server 2016的发布,SSRS中有许多新功能,以及现有报告布局的更改。 SSRS的一些重要变化包括:
- Brand new Reporting services web portal 全新的Reporting Services网站门户
- Custom branding for the web portal Web门户的自定义品牌
- Key performance indicators (KPI) in the web portal Web门户中的关键绩效指标(KPI)
- Mobile reports 行动报表
- Power BI dashboard Power BI仪表板
- TreeMap and Sunburst Charts TreeMap和森伯斯特图
- Subscription Improvements 订阅改进
- Report Builder improvements 报表生成器的改进
SQL Server中的移动报告 (Mobile reports in SQL Server)
SQL Server 2016 takes a next step in reporting services by introducing Mobile reports. With the increase of smartphones and tablets, it is very much necessary to create the reports that are accessible, compatible on mobile and tablets. There are different screens sizes available for mobiles and tablets so the reports should have optimal viewing experience on these devices.
SQL Server 2016通过引入移动报告在报告服务方面迈出了下一步。 随着智能手机和平板电脑的增长,迫切需要创建可访问且兼容手机和平板电脑的报告。 手机和平板电脑有不同的屏幕尺寸,因此报告在这些设备上应具有最佳的观看体验。
Microsoft acquired mobile business intelligence and data visualization leader Datazen Software in 2015. SSRS mobile reports are built on Datazen technology.
微软在2015年收购了移动商务智能和数据可视化领导者DatazenSoftware。SSRS移动报表基于Datazen技术构建。
移动报表发布器工具安装 (Mobile report publisher tool Installation)
We need to install the Mobile Report Publisher tool to create mobile reports. Use this link to download the tool.
我们需要安装Mobile Report Publisher工具来创建移动报告。 使用此链接下载该工具。
This application requires .NET Framework 4.5 (or later) and Visual C++ Redistributable for Visual Studio 2012 (x86). We get the error if Visual C++ Redistributable for Visual Studio 2012 (x86) is not present.
此应用程序需要.NET Framework 4.5(或更高版本)和Visual Studio 2012(x86)的Visual C ++可再发行组件。 如果不存在针对Visual Studio 2012(x86)的Visual C ++可再发行组件,则会出现错误。

After installation , the Mobile Report publisher installation is as shown below.
安装后 ,Mobile Report Publisher安装如下所示。







To create reports, launch Microsoft SQL Server Mobile Publisher and it will appear as below
要创建报告,请启动Microsoft SQL Server Mobile Publisher,它将显示如下
SQL Server Mobile Report Publisher consists of multiple parts as below.
SQL Server Mobile Report Publisher由多个部分组成,如下所示。
- Layout (Navigators, Gauges, Charts) 布局(导航器,量规,图表)
- Data (Add data, Refresh all data, Export all data) 数据(添加数据,刷新所有数据,导出所有数据)
- Reports settings 报告设定
- Preview ( master, tablet, mobile mode) 预览(主版,平板电脑,移动模式)
- Grid control 网格控制
- Layout control 布局控制
创建新的移动报告 (Create new mobile report )
To create new mobile report, we need to import data. We can add data from either an Excel worksheet or the Report Server.
要创建新的移动报告,我们需要导入数据。 我们可以从Excel工作表或报表服务器中添加数据。
Click on add data provides options as shown below
单击添加数据提供如下所示的选项

If we want to add the data from the report server, click on the report server and provide the report server address along with the credentials.
如果我们要从报表服务器添加数据,请单击报表服务器,然后提供报表服务器地址和凭据。

Now click on connect and it will display the reporting site name after connected. The dataset should be created first to be utilized here. We can select the dataset that we want for the data purpose.
现在单击连接,连接后将显示报告站点名称。 首先应创建数据集以在此处使用。 我们可以选择想要用于数据目的的数据集。
If we want to update the data, later on, we can use option ‘Refresh all data’. Apart from this ‘Export, all data’ option can be used to export data into excel sheet.
如果我们要更新数据,稍后可以使用选项“刷新所有数据” 。 除了此“导出,所有数据”选项之外,还可以用于将数据导出到Excel工作表中。
报告设定 (Report settings)
Before we start configuring new reports, we can do some customization for the reports. Click on Settings tab shows the options.
在开始配置新报告之前,我们可以对报告进行一些自定义。 单击设置选项卡显示选项。
Report Title: The report title will appear in the report header. By default, it is New Mobile Report.
报告标题:报告标题将显示在报告标题中。 默认情况下,它是“新移动报告”。
Currency: By default, it will take currency like USD, there are various currency options available as a drop-down.
货币:默认情况下,它将采用美元之类的货币,下拉菜单中提供了多种货币选项。
Fiscal year start: we can specify the fiscal year start as well. Some countries have their fiscal year start from April so we can change it accordingly.
会计年度开始:我们也可以指定会计年度开始。 一些国家的会计年度从4月开始,因此我们可以相应地对其进行更改。
The first day of the week: We can define the first day of the week, by default it is Sunday.
一周的第一天:我们可以定义一周的第一天,默认情况下为星期日。
Effective date: we can also define an effective date for “Today” in the format of yyyy-mm-dd or yyyy-mm-dd hh:mm:ss.
生效日期:我们还可以使用yyyy-mm-dd或yyyy-mm-dd hh:mm:ss的格式为“今天”定义生效日期。
Enable client data caching: this option gives the ability to enable or disable client data caching, this is default enabled.
启用客户端数据缓存:此选项提供启用或禁用客户端数据缓存的功能,默认情况下启用。
Encrypt data stored on the client: If we want to store the sensitive data at the client level, we can enable this.
加密存储在客户端上的数据:如果我们想在客户端级别存储敏感数据,则可以启用它。
移动报告的布局 (Layout of mobile reports )
We can choose from the layout mode as Master, Tablet, and Phone. By default, it is the master layout.
我们可以从布局模式中选择“主机”,“平板电脑”和“电话”。 默认情况下,它是主布局。
We can also choose the color palette as well from the different color palette provided.

我们还可以从提供的不同调色板中选择调色板。
Grid Rows and Columns: We can choose the no of grid rows and columns for our report. The default value is five grid rows and ten grid columns. We can easily change these values just by click on the line bar.
网格行和列:我们可以为报告选择网格行和列数。 默认值为五个网格行和十个网格列。 我们只需单击线栏即可轻松更改这些值。
设计移动报告 (Design mobile report)
Suppose we want to build the mobile report with the below components
假设我们要使用以下组件构建移动报告
- Time Navigator 时间导航器
- Gauges 量规
- Charts 图表
- Data grids 数据网格
For my report, I have used the sample data provided along with the mobile report publisher tool. Now, I will go through each item and see how we can configure those.
对于我的报告,我使用了随移动报告发布器工具一起提供的示例数据。 现在,我将遍历每个项目,并了解如何配置它们。
-
Time navigator
It provides an option to see the data based on different time intervals. To add this drag this into one of the columns and it will look like as
Now to expand the time intervals i.e. last year, last quarter keeps dragging it towards right.
If we want to change the size of the graph, just drag this to multiple rows.
It provides further customization option for the time navigator
Time intervals: it gives options to define time intervals to years, months, weeks, days, hours.
Number format: We can select from the various number format provided.
Visualization type: We can select graph type as bar, line, area, and step area.
Time range pre-sets: here we can define what should be the time range. There are a couple of options provided here.
Show comparison delta: this provides further details into the graph by including comparison delta details.
Accent: By default, the accent is off. If we enable it, the background of the graph appears as shown below.
Suppose we want line visualization with Delta show comparison on so that time navigator will look like
时间导航器
它提供了一个选项,可以根据不同的时间间隔查看数据。 要添加此内容,请将其拖到其中一列中,它看起来像
现在要扩大时间间隔,即去年,最后一个季度将其拖向右边。
如果要更改图形的大小,只需将其拖动到多行即可。
它为时间导航器提供了更多的自定义选项
时间间隔:它提供了将时间间隔定义为年,月,周,天,小时的选项。
数字格式:我们可以从提供的各种数字格式中进行选择。
可视化类型:我们可以选择图形类型为条形,线形,面积和台阶面积。
时间范围预设:在这里我们可以定义时间范围。 这里提供了两个选项。
显示比较增量:通过包括比较增量详细信息,从而在图表中提供更多详细信息。
重音:默认情况下,重音处于关闭状态。 如果启用它,则图形的背景如下所示。
假设我们希望将线形可视化与Delta显示进行比较,以便时间导航器看起来像
-
Gauges
SSRS Mobile reports provide many gauges to select as shown below
Now we want to add gauges to the report. For this report, I have used half–donut. Similar to time navigator we can adjust it to multiple columns and rows.
It is also having configuration option available similar to the previous one. Few important configurations are below.
Title: By default, it displays as half donut 1. I change it to “Gauges”
Ring type: it is showing half ring as of now. If we want to have a full ring, change this property to the full ring.
量规
SSRS Mobile报告提供了许多量规供选择,如下所示
现在我们要向报告添加量规。 在本报告中,我使用了半圆面包。 与时间导航器类似,我们可以将其调整为多列和多行。
它还具有与上一个类似的可用配置选项。 以下是一些重要的配置。
标题:默认情况下,它显示为半甜甜圈1。我将其更改为“ Gauges”
铃声类型:截至目前显示半个铃声。 如果我们想要一个完整的铃声,请将此属性更改为完整的铃声。
-
Charts
We have a couple of chart options to choose as shown below.
Suppose we want to add funnel chart into our report so drag it to the report and customize it from the options provided.
图表
我们有两个图表选项可供选择,如下所示。
假设我们要将漏斗图添加到报告中,因此将其拖到报告中并从提供的选项中对其进行自定义。
-
Data grids
We can select the data grid from the options provided and configure it similar to the time navigator.
I have renamed the report to “sqlshack demo”, and my final report preview looks as shown below
数据网格
我们可以从提供的选项中选择数据网格,并类似于时间导航器进行配置。
我已将报告重命名为“ sqlshack demo”,并且最终报告预览如下图所示
将报告从母版转换为平板电脑 (Converting report from master to tablet)
Now to convert the master report to tablet layout click on a tablet from the drop-down. The report layout is now as shown below
现在要将主报表转换为平板电脑布局,请从下拉菜单中单击平板电脑。 现在,报告布局如下图所示
A report element shows the elements like a graph, gauge, data, chart we used in the master report.
报表元素显示了我们在主报表中使用的元素,例如图形,量表,数据,图表。
Now drag and drop the elements into the tablet layout like below
现在,将元素拖放到平板电脑布局中,如下所示
Click on the preview to see the final report and you can see the report in a tab format.
单击预览以查看最终报告,您可以以标签格式查看报告。

将报告转换为手机 (Converting report to mobile)
We can convert the report to mobile layout as similar to the previous one, just change the layout mode to the phone, drag-drop the report elements and preview the report.
我们可以像以前一样将报告转换为移动版式,只需将布局模式更改为手机,将报告元素拖放到并预览报告即可。
Once we have created the report, click on save mobile report. We can save the report to the file system or the server. If we select the server, we can choose the report name, server name, and location where we want to publish it.
创建报告后,请点击保存移动报告。 我们可以将报告保存到文件系统或服务器。 如果选择服务器,则可以选择报告名称,服务器名称以及要在其中发布的位置。


Once deployed we can see the report showing as a thumbnail. The report is now accessible on the mobile, tablets format.
部署后,我们可以看到报告显示为缩略图。 现在可以通过移动平板电脑格式访问该报告。

结论 (Conclusion)
Mobile Reports are an exciting feature in the SQL Server Reporting Services. It is easy to develop reports using the mobile report publisher tool. Explore these reports in your environment and take advantage of the rich functionality.
移动报表是SQL Server Reporting Services中令人兴奋的功能。 使用移动报告发布器工具可以轻松地开发报告。 在您的环境中浏览这些报告,并利用其丰富的功能。
有用的链接 (Useful links)
- Create mobile reports with SQL Server Mobile Report Publisher 使用SQL Server Mobile Report Publisher创建移动报告
- Introducing mobile reports 介绍移动报告
- Bring business insights to more people with SQL Server 2016 mobile reports 通过SQL Server 2016移动报表将业务洞察力带给更多人
翻译自: https://www.sqlshack.com/create-configure-sql-server-mobile-reports/