Relation Dataset

  • Last update:  2021-01-26
  • I. Overview

    1) Relation dataset, similar to the Union in SQL statements, can link 2 or more datasets coming from different databases, and merge 2 or more table structures.

    2) For example, one template has defined two datasets ds1 and ds2, which were fetched from Oracle and SQL Server, and you plan to use a parameter to determine whether the report data are from ds1 or ds2.

    3) Data sources in the Designer can be divided into two types according to their scope of application: Template dataset  and server dataset. We use template dataset as an example here. The operation method of server datasets is similar to that of template datasets, and will not be discussed here.

    You will learn
    • Steps

      • Create an original dataset

      • Create a relation dataset

      • Set the parameters of a relation dataset

    II. Steps

    1. Create an original dataset.

    1) Use FRDemo to create a DB query dataset ds1, for details, please refer to DB Query. The SQL statement is as follows:

    SELECT DISTINCT Region, Salesperson FROM Sales_Volume

    The data is shown below.

     1.png

    2) Use FRDemo to create a DB query dataset ds2. The SQL statement is as follows:

    SELECT DISTINCT Region, Product FROM Sales_Volume

    The data is shown below.

     1604911740603315.png


    2. Create a relation dataset

    1) Create a relation dataset.

     1604911743538389.png

    2) Name the dataset and check the ds1 and ds2 that need to be linked.

     1604911756175318.png

    3) Click 1604911784641100.png above to preview the result.

    The merge rule is as follows: If several datasets with different field names are merged, merging begins from top to bottom from the first data set, and the same field name will be used for merging. If encountering different field names, the new field name will be added. If a field does not exist in the dataset before the merge, field values are null.

    For example, the relation dataset displays all the columns of ds1 and ds2, and is linked according to the common Region field. There is no Product field in ds1, so in the relation dataset, the Product field for records coming from ds1 is empty. Similarly, there is no Salesperson field in the ds2, so in the relation dataset, the Salesperson field for records coming from ds2 is empty.

     1604911759291017.png


    3. Set the parameters of a relation dataset

    You can also set parameters in a relation dataset. For example, you can use parameters to control the results of a relation dataset.

    1) Input parameter formulas in the Condition Formulas.

    Input the following formula in the Condition Formulas field of ds1. $dsname="ds1”.

    Input the following formula in the Condition Formulas field of ds2: $dsname="ds2”.

    2)You can obtain the parameter dsname. When the parameter value is ds1, then the parameter dsname corresponds to the result of ds1 dataset; and when the parameter value is ds 2, then the parameter dsname corresponds to the result of ds3 dataset. Refresh the interface, and you will see the set parameters below.

     1604911762594361.png

    2) Click Preview button, and enter ds1 to preview the data of ds1. Return to the Preview interface and enter ds2 to preview the data of ds2.

     1604911766846281.gif

     

    Attachment List


    Theme: Data Preparation
    • 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