Report design of complex dynamic reports

Statement of needs

imagepng

imagepng

As shown above, the packet may need to choose different dimensions of the data analysis, such as category, supplier dimension;
data can be filtered through a dynamic parameter values entered by the user, for example, a query to filter incoming data value different suppliers, categories;
additional field data may be selected to be displayed;
simultaneously displayed ranking requirement (data in each packet in descending shown), the proportion (percentage of the product of the total dimension of the packet order quantity).

Production process:

1. Data Preparation

This example uses the complete data set preparation script data, script data set is used here in consideration of the demand Rank complete the configuration script as shown below:

imagepng

Wherein,
A1: using the connect function connected to a data source demo
A2: query using a query function to filter data
A3: using the group and the group sorting sort function to achieve the effect, i.e., the ranking results

2. The main reporting

imagepng

其中,
A2:=if(arg1==“供应商 ID”,ds1.group( 供应商 ID:1),ds1.group(类别 ID:1)) 实现动态分组效果
B2:=ds1.sum(订购量) B 列为隐藏列,用于占比的分母值计算
C2:=&D2 排名效果实现,此处使用组内序号的配置即可,数据集准备的数据中已完成排名计算
D2:=ds1.select(产品 ID) 明细数据的展现,跟随 A2 不同的分组维度显示产品明细
E2:=ds1. 订购量 同一个数据集的 select 函数后面跟随取值表达式,不需要再使用 select 函数取数
F2:=if(B2==0,“-”,E2/B2) 占比的实现是除法,准备好分子和分母的数据即可,此处使用 if 对分母为 0 的数据做了特殊处理,显示为“-”
G1:=split(arg4,“,”) 对传入要附件显示的列名进行拆分,需要设置 G1 单元格的扩展方式为横向扩展
G2:=ds1.field(G1) 使用 field 函数对该字段进行取数显示

主表设计完成,保存报表,例如保存名称为:kehu1.rpx,我们可以通过设计器的预览按钮看下效果:

imagepng

输入参数值后,得到如下结果:
imagepng

3. 参数模板设计

imagepng

文件–新建报表,设置报表属性中的报表类型为:参数模板
绘制上图所示的表样
其中,
B2:编辑风格为下拉列表,并设置 web 变量名为 arg1

imagepng

D2:编辑风格为下拉数据集,并设置 web 变量名为 arg2

imagepng
此 ds1 数据集需在参数模板的 报表–数据集中进行定义

F2: editorial style drop-down data sets, and sets the variable named web arg3
B3: editorial style for the drop-down list, and set the variable named web arg4

Finally, the parameter template save the main table name _arg.rpx, this example the name kehu1_arg.rpx

So far, the overall effect has been to complete the setup.

Guess you like

Origin www.cnblogs.com/xiaohuihui-11/p/12054606.html