Data Comparison Example

  • Last update: July 23, 2025
  • Overview

    The function of the Data Comparison operator is introduced in Function Description of Data Comparison. This document uses a simple example to demonstrate how to use the Data Comparison operator.

    Example

    Scenario Description

    You can download the example data: Fsale.xls and Fsale_Copy.xls.

    You need to periodically synchronize the data in the Fsale table to the Fsale_Copy table.

    The data in the Fsale_Copy table is shown in the following figure.

    2.1-1.png

    Compared with the data in the Fsale_Copy table, the data of Sugarcane and Frozen pear is deleted, the data of Grape is inserted, and the data of Pineapple is updated in the Fsale table. You want to synchronize the latest data to the Fsale_Copy table.

    2.1-2.png

    Configuring the Source and Target Tables

    This section extracts the data from the source and target tables to facilitate the marking of added, deleted, or modified the data in the subsequent Data Comparison operator.

    Note that the Data Comparison operator treats the input operator above as the source table, and the one below as the target table.Therefore, in this example, place the input operator extracting the data from the Fsale table above and use the data in the Fsale table to compare with that in the Fsale_Copy table.

    2.2.png

    Creating a Task

    Create a scheduled task and drag a Data Transformation node onto the design page, as shown in the following figure.

    2.2.1.png

    Configuring the Source Table

    1. Click the Data Transformation node, drag a DB Table Input operator onto the design page, and rename it Source Table on the Node Information tab page, as shown in the following figure.

    2.2.2-1.png

    2. Configure the data source and use the SQL statement to extract all the data from the Fsale table, as shown in the following figure.

    2.2.2-2.png

    Configuring the Target Table

    Add another DB Table Input operator and rename it Target Table.Use the SQL statement to extract all the data from the Fsale_Copy table, as shown in the following figure.

    2.2.3.png

    Configuring the Data Comparison Operator

    1. Add a Data Comparison operator and connect it to the two DB Table Input operators as the downstream operator using connectors, as shown in the following figure.

    2.3-1.png

    2. In the Data Comparison operator, configure the logical primary key and comparison field, as shown in the following figure.

    2.3-2.png

    The following table describes the setting items.

    Setting Item
    DescriptionExample

    Comparison Source

    Auto-generated

    /

    Primary Key Mapping

    You can select fields for logical primary key mapping to identify the same record in both tables by matching the data in the source and target tables. You are advised to select the NOT NULL field with unique values as the logical primary key.

    ID

    Comparison Field

    You can set field pairs, based on which the corresponding values in two tables will be compared. An identifier column fdl_comparison_type will be automatically generated based on the comparison results. This column can be unmapped in Field Mapping in the DB Table Output operator.

    If a field is selected as Comparison Field, data insertions, updates, and deletions on this field are identified.

    If a field is not selected as Comparison Field, data insertions and deletions on this field are identified, but any updates on it cannot be identified.

    In this example, the column with data changes is the Sales column, so select Sales as Comparison Field.

    Identifier

    Set the values of the identifier column fdl_comparison_type, which are used to mark differences in values of paired fields between two tables.The default values are IdenticalChangedAdded, and Removed. You can customize the values.

    No modification is needed. Keep the default settings.

    Comparison Result Table Field

    1. All the fields in the comparison result table can be selected if you tick Add Right Table Field to Comparison Result Table. No field is selected by default and no configuration is required.

    2. When the comparison table of the Data Comparison operator is selected via the Jodoo Input operator, the comparison result table field defaults to _id.

    For details about usage scenarios, see Jodoo Output Operator.

    No configuration is required.

    The Data Preview page is shown in the following figure.

    2.3-3.png

    Configuring the DB Table Output Operator

    1. Add a DB Table Output operator and connect it to the Data Comparison operator using a connector.

    2. Configure the DB Table Output operator to store the latest data in the target table Fsale_Copy. In Field Mapping, select Map Fields with Same Name and click the QQ20250723-143956.png icon to unmap the target table field fdl_comparison_type, as shown in the following figure.

    2.4-1.png

    3. Click Write Method, select Add/Modify/Delete Data Based on Identifier Field as White Method, select Physical Deletion. Select ID as the logical primary key and select fdl_comparison_type as Identifier Field. Values set in Identifier Value should correspond with the values of Identifier accordingly in the Data Comparison operator, as shown in the following figure.

    2.4-2.png

    4. Click Save in the upper right corner.

    Running the Task

    Click Run in the upper right corner. If a message indicating successful task execution is displayed in Log, the task is successfully executed, as shown in the following figure.

    2.5-1.png

    The data in the Fsale_Copy table is consistent with that in the Fsale table, as shown in the following figure.

    2.5-2.png

    附件列表


    主题: Data Development - Scheduled Task
    Previous
    Next
    • 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