For RAQ Report Free Edition without OLAP analysis function, if a report is released to web page, its display style is fixed. If developers want to display it in another style, they have to design a new report template. However, RAQ Report Free Edition provides a convenient method to realize this requirement.
Take a multiple-level cross grouping report for an example. The top report header is region and city, while the left report header is time.
If we want to change the style of the report dynamically, Vertically grouped by time and horizontally by ragion. With RAQ Report Express Edition, we just need to use parameters to realize exchange between rows and columns as the article title mentioned.
1. Set cell expressions to be changed according to different parameters. Then, display style will be changed with cell expressions.
2. Click a hyperlink button to forcibly pass parameters to cells through URL, and thus control the display style of the report.
Take the report shown above for example, we will exchange rows and columns (top report header and left report header) to realize display style changing.
Step 1: Click Configure -> Parameter in the report IDE.
Add a parameter which is used to exchange column and row for the report.
Step 2: Modify cell expressions to accept parameters.
Here, we modify the expression of cell C2 to =if(@arg1=='1',ds1.group(year(Orderdate),false,Orderdate!=null)+"Year",ds1.group(ShipperRegion,false,ShipperRegion!=null)).
It means that when the value of parameter arg1 is 1, the expression of cell A2 is ds1.group(year(Orderdate),false,Orderdate!=null)+"Year". Or else, it is ds1.group(ShipperRegion,false,ShipperRegion!=null) by default.
For the usage of function if(), please refer to relevant tutorials of RAQ Report.
In a similar way, according to the relations of region and city, and the relations of year and month, we modify the other cell expressions as shown below:
Step 3: Modify cross report header and set hyperlink in it.
The cross report header in the red rectangle is the key of the report. The content in it will be changed with the exchange of row and column. Moreover, it is the control button of the exchange.
Modify the cell expression to =if(@arg1=='1',"City,Freight,Time","Time,Freight,City").
Then, click URL in its properties.
Add the expression in the edit box.
With this hyperlink, if users click this cell, it will assign parameter value for arg, and pass the parameter to the report in JSP through the URL in the hyperlink. After checking parameter value, it will locate the URL in the hyperlink. Then, users can exchange row and column freely. (In fact, the hyperlink can also be set in other cells.)
Clicking the cell in the rectangle, the URl will be automatically changed to /reportJsp/showReport.jsp?raq=/crossreport.
raq&arg1=1. Then, forcibly pass arg=1 to each cell of the report. Cell expressions change, and report style changes correspondingly.
If users want to go back, they only need to click the button again.
In this example, we used some skills. Such as cross grouping report, parameter with hyperlink, function if(), etc. In fact, some reports may be seems to be complex, but we can make them easily with RAQ Report