I. Overview
1. Version
Rreport server version |
---|
10.0 |
2. Expected effect
In the original data table, the encoded data is saved, while in the data presentation, the actual values need to be displayed, while the encoding and values are often saved in another table.
For example, in the ordersdetail table of the built-in FRDemo database, there is only ProductID, and the corresponding ProductName is in the products table. You want to display the product ID in the order details report as the corresponding product name, as shown in the following figure:
3. Implementation ideas
1) Method 1: set the actual value and display value by using the display setting in cell attributes
2) Method 2: using function split and combining with display setting.
II. Method 1: Data Dictionary
1. Report design
Create a new data set DS1, write the SQL query statement select * from ordersdetail in the database query.
Design the table as following:
2. Setting up the data dictionary
Select the cell of ProductID data column, select cell attributes > Form > data dictionary, set the actual value as the ProductID column in the customer table, and display the value as the ProductName column in the Products table, as shown in the following figure:
3. Save and preview
Save the template and click preview. The effect is as expected in I.2.
III. Method 2: formula setting
1. Application scenarios
When there are multiple products in a cell and it is separated by a symbol, the above method can not achieve the final effect.
The actual results are not in accordance with the requirements. In this case, you can achieve the following result.
2. Report design
Add the following two built-in dataset:
Design the table as following:
Set the formula in cell C2: = split (B2, ","), and add the display setting which reference to Method 1.
2) Set C2 cell expansion direction: none, parent cell: default.
3) Set D2 cell expansion direction: vertical, left parent cell: B2.
4) Right click column B to hide.
3. Save and preview
Save the template and click preview. The effect is as III.1.
IV. Template download
For completed templates, please refer to:
%fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\ReportDesign\Displayed-Actual1.cpt
%fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\ReportDesign\Displayed-Actual2.cpt
Click to download the template: