Overview
Version
Report Server Version | Functional Change |
---|---|
11.0 | / |
Problem
When you perform a fuzzy query on a report, you want to highlight the fuzzy keywords in the data columns obtained by the query, as shown in the following figure.
Implementation Method
You can convert the keywords in the corresponding data columns to HTML labels with highlighted colors, and then display the keywords by HTML.
Procedure
1. Create a dataset query with the SQL statement SELECT * FROM Sales_Volume where 1=1 ${if(len(name)=0,"","and Salesperson like '%"+name+"%'")}, as shown in the following figure.
2. Design the report, drag the fields into the corresponding cells, select cell D2, and select Summary and Sum under Cell Element > Data Setting, as shown in the following figure.
3. Select cell B2, select Formula Form under Cell Attribute > Display, and set the formula to replace($$$,$name,"<font color='red'>"+$name+"</font>"), as shown in the following figure.
4. Select Display by HTML in Display Content under Cell Attribute > Others > Advanced, as shown in the following figure.
5. Add the corresponding widget to the parameter panel.
Effect Display
PC
Save the template and click Pagination Preview. The effect is the same as that shown in section "Problem."
Mobile Terminal
The preview effects on the DataAnalyst app and the HTML5 terminal are the same, as shown in the following figure.
Template Download
For details, you can download the template Keyword Highlighting During the Fuzzy Query in the Text Widget.cpt.