Hyperlink to Template with Parameters

  • Last update:  2021-03-16
  • I.Overview

    1.Expected effect


    When setting a hyperlink, you will encounter that the template you are linking to has parameters. It is hoped that when the hyperlink is clicked, the content of the current cell is passed as the parameter value to the parameter of the next report. As shown below:

    1.gif

    2.Implementation method


    Realize hyperlinks to templates with parameters through web reports or JavaScript scripts.

    II. Example 1: Web Report

    1.Sub-template


    Create a new general report and save it as%FR_HOME%\webapps\webroot\WEB-INF\reportlets\Hyperlink to a template with parameters-subreport.cpt

    1)New Data Set

    New data set ds1: SELECT * FROM [Sales_Volume] where 1=1 ${if(len(area) == 0,"","and Region ='" + area + "'")}

    areais the name of a custom parameter, that is, the filter name (control name) of the corresponding area. Judge whether the control value is empty, if it is empty, query all by default.

    1614930671352915.png

    2)Design report

    The report page design is shown in the figure below:

    3.jpg

    Select cell C2, select cell element> basic, and set the data to summary and sum. As shown below:

    4.jpg

    2. Master template


    Create a new general report and save it as%FR_HOME%\webapps\webroot\WEB-INF\reportlets\Hyperlink to the template with parameters-the main report.cpt

    1)New Data Set

    New data set ds1: SELECT * FROM Sales_VolumeAs shown below:

    5.png

    The report page design is shown in the figure below:

    1583804029559884.png

    Select cell C2, select cell element> basic, and set the data to summary and sum. As shown below:

    7.jpg

    3.Set up hyperlinks and pass parameters


    Open Hyperlink to the template with parameters-the main report.cpt, select cell A2, and click the hyperlink to add a network report.

    Web report select/Hyperlink to the template with parameters-the main report.cpt,the link will open in a new window, set the parameter area=$$$

    As shown below:

    1614931481484074.png

    4.Effect preview


    1)PC terminal

    Save the template and click Pagination Preview to preview. As shown below:

    11.gif

    2)Mobile

    The preview effect of App and HTML5 is shown in the figure below:

    9.gif

    III.Example 2: JavaScript script

    1.Template settings


    Sub-template settings are consistent with section 2.1 of this article, save as %FR_HOME%\webapps\webroot\WEB-INF\reportlets\Hyperlink to template with parameters-subtemplate.cpt

    • Sub-template settings are consistent with section 2.1 of this article

    %FR_HOME%\webapps\webroot\WEB-INF\reportlets\Hyperlink to template with parameters-sub-template.cpt

    • 2The main template settings are consistent with section 2.2 of this article

    %FR_HOME%\webapps\webroot\WEB-INF\reportlets\Hyperlink to the template with parameters-the main report.cpt

    2.Set up hyperlinks and pass parameters


    Open Hyperlink to a template with parameters-JavaScript script.cpt, select cell A2, click the hyperlink, and add the JavaScript script.Set parameter A=A2, add JavaScript code, as shown in the figure below

    10.jpg

    The JavaScript code is as follows:

    window.open("${servletURL}?viewlet=Hyperlink to a template with parameters-sub-template.cpt&op=view&area="+A);

    3.Effect preview 


    Save the template and click on the page to preview. Click "East China" to jump to the sub-template, and the sub-template only displays the data in the "East China" part. As shown below:

    11.gif

    Note: Mobile terminal is not supported.

    IV. Template Download

    4.1 Example 1: Network report


    1)Master template

    Click to download the template: Hyperlink to the template with parameters-the main report.cpt


    2)Sub-template

    Click to download the template: Hyperlink to a template with parameters-subreport.cpt

    4.2 Example 2:JavaScript

    2)Master template

    Click to download the template: Hyperlink to a template with parameters-JavaScript script.cpt

    2)Sub-template

    Click to download the template: Hyperlink to a template with parameters-sub-template.cpt


    Attachment List


    Theme: Report Features
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy