简体   繁体   中英

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:

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.

  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. 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.

  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. In Value, select the field that contains the values that you want to pass to the SQL query or filter condition at run time.

  7. In Display Text, optionally select a field that contains the values that you want to display to the user. 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.

  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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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