简体   繁体   English

如何在计算列上过滤 Birt(参数)?

[英]How can I filter in Birt (Parameter) on a computed column?

Is it possible to add a parameter to filter by a computed column and if so how?是否可以添加一个参数来按计算列进行过滤,如果可以,如何进行过滤?

I have a report which gives the level of a bill of material and this is set as level in Birt as a computed column using the following expression:我有一份报告,它给出了物料清单的级别,并且使用以下表达式将其设置为 Birt 中的级别作为计算列:

var result = "" ;
for(i = 0; i< row["depth"]; i++) {
result = result + "." 
}
result = result + row["depth"] ;
result;

I found a solution through a separate forum thanks to another user, they advised that you can do this by using a Cascading Parameter which solves this.感谢另一个用户,我通过单独的论坛找到了一个解决方案,他们建议您可以通过使用解决此问题的级联参数来做到这一点。

I found the solution and thought others may find this useful.我找到了解决方案,并认为其他人可能会觉得这很有用。

How to create cascading parameters that use a single data set.如何创建使用单个数据集的级联参数。

  1. In Data Explorer, right-click Report Parameters, and choose: New Cascading Parameter.在 Data Explorer 中,右键单击 Report Parameters,然后选择:New Cascading Parameter。

  2. On New Cascading Parameter, in Cascading Parameter Name, you can specify a different name if you do not want to use the default name.在 New Cascading Parameter 中,在 Cascading Parameter Name 中,如果不想使用默认名称,可以指定不同的名称。 The name that you specify appears only in the list of report parameters in Data Explorer.您指定的名称仅出现在数据资源管理器的报表参数列表中。

  3. In Prompt text, specify the name for the parameter group that appears in the Enter Parameters dialog.在提示文本中,指定出现在输入参数对话框中的参数组的名称。

  4. Select Single Data Set. Select 单个数据集。

  5. Create the report parameters for this group of cascading parameters.为这组级联参数创建报表参数。

  6. In Parameters, choose Add.在参数中,选择添加。 On Add Cascading Parameter, specify the following values:在添加级联参数上,指定以下值:

    In Name, type the parameter name.在名称中,键入参数名称。 In Data Set, select the data set that returns the values for populating all the parameter lists.在数据集中,select 返回用于填充所有参数列表的值的数据集。 In Value, select the field that contains the values that you want to pass to the SQL query or filter condition at run time.在值中,select 包含要在运行时传递给 SQL 查询或筛选条件的值的字段。

  7. In Display Text, optionally select a field that contains the values that you want to display to the user.在显示文本中,可选 select 一个字段,其中包含您要向用户显示的值。 For example, the values to pass to the SQL query or filter condition are from the productcode field, but you want to display values from the productname field to the user.例如,要传递给 SQL 查询或筛选条件的值来自 productcode 字段,但您希望将 productname 字段中的值显示给用户。

  8. Choose OK.选择确定。

  9. In Properties, set the other properties for this report parameter, including the prompt text, display type, and default value.在“属性”中,设置此报表参数的其他属性,包括提示文本、显示类型和默认值。

  10. To create the next report parameter, choose Add, and follow the same steps until you set up all levels of the cascading parameter group.要创建下一个报告参数,请选择“添加”,然后按照相同的步骤操作,直到设置好级联参数组的所有级别。

使用单个数据集的级联参数示例。

  1. When you finish creating all the report parameters in the group, choose OK.完成组中所有报表参数的创建后,选择确定。 The cascading parameters appear in Report Parameters in Data Explorer.级联参数出现在 Data Explorer 的 Report Parameters 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM