Drop-down box shows multiple columns

  • Last update:  2021-10-20
  • I. Overview 

    1) Expected effect

    When users click the drop-down box widget to select from the drop-down list, it is often a purposeful choice. Therefore, the more complete the record that pops out of the drop-down box, the more convenient it is for users to select data by using the drop-down box widget.

    As shown in the picture below, click the drop-down box of student ID to display the student ID, class and student name in the drop-down list.

    0.jpg

    2) Implementation roadmap

    Select the columns to be displayed using the value formula definition, and then combine the columns to be displayed in the display values of the drop-down box.

    II. Steps

    1. Preparing a template

    1) Click "File > New General Report" in FineReport Designer to add dataset ds1, SQL statement is:

    SELECT * FROM STSCORE

    2) The template is as follows:

    1.jpg


    2. Adding parameters

    Click "Template > Template Parameters", add the parameter "std" and click "OK". As shown below:

    2.jpg


    3. Setting widgets

    Add Drop-down box widget and Query widget in the parameter panel. The component name of the drop-down box widget is std. Set the data dictionary for the drop-down box widget. Set the type toData Query. The dataset is ds1 and the actual value is STUDENTNO.The displayed value is expressed by the formula:

    $$$ + " "+ VALUE("ds1",1,2,$$$,1)+" "+ VALUE("ds1",3,2,$$$,1)

    3.jpg

    Formula description:

    Note: For details about the value function, see introduction to the Value Function Into.

    $$$: The actual value of the current cell.

    VALUE("ds1",1,2,$$$,1) : Returns the elements in the first column of ds1 whose corresponding VALUE in the second column is $$$.

    VALUE("ds1",3,2,$$$,1) : Returns the elements in the third column of ds1 whose corresponding VALUE in the second column is $$$.

    The final argument: if the value is less than 0, the first value of the array is taken; if the value is greater than the array length, the last value of the array is taken and the results are concatenated into a string.


    4. Adding filter criteria

    Double-click on cell A2, click Filter,The optional column is STUDENTNO ,which equals to $std, as shown in the following figure:

    4.jpg

    III. Effect Viewing

    Save the template and click Pagination Preview to see what you expect in Section Iof this article.

    IV. Completed template

    The completed template can be seen in the %FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\Parameter\Drop-down_box_shows_multiple_columns.cpt

    Click to download the template: 

    Drop-down_box_shows_multiple_columns.cpt


    Attachment List


    Theme: Parameter
    • 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