Add a data map

Updated at:

You can map data from device topics, APIs, and custom storage tables to the TSL model properties of a digital twin node. This topic describes how to add a data map.

Prerequisites

  • You have configured TSL features for the digital twin node. For more information, see Configure TSL Features.

  • You have the ID and name of the digital twin node and the identifiers of its TSL features.

Procedure

  1. Go to the digital twin space page. For instructions, see View a Digital Twin Space.

  2. In the left-side navigation pane, click Data Ingestion.

  3. Click Add Data Map.

  4. In the Add Data Map panel, configure the following parameters and click OK.

    Parameter

    Description

    Data map name

    A custom name for the data map. The name can be up to 32 characters long and can include Chinese characters, letters, digits, underscores (_), and hyphens (-). Each Chinese character counts as two characters.

    Data source type

    Valid values:

    • Topic: Select the source message topic.

      • Custom

        For custom topics, you can use the + and # wildcards.

        • The + wildcard matches a single level in a topic. For example, it can represent all devices under a product.

        • The # wildcard matches multiple levels at the end of a topic. For example, /user/# specifies all custom topics for the device.

        For more information about custom topics, see Custom Topics.

      • TSL Property Reporting

        The topic that a device uses to report properties: thing/event/property/post.

      • Data Service: Data Parsing

        Select a data parsing task under the current instance.

        To use the output of a data parsing task as a data source, you must set the Destination Node for the task to the current IoT Digital Twin space. For more information, see Configure a Destination Node.

    • API: Select the product and device for the API data source. Then, call the ImportDTData API operation to trigger the execution of the data map script.

    • Data Table: Select a custom storage table from the data service of the current instance.

      To use a custom storage table as a data source, you must first configure it to send data back to the digital twin space. Table fields can be mapped directly to the properties of a digital twin node. For more information, see Create and manage custom storage tables.

      Important

      A data table can be associated with only one data map.

    Script

    Click Select File to upload a .txt script file and a .json output file.

    For more information about the script and output syntax, see Script and output syntax.

    Note

    Script and output files are required only when Data Source Type is set to Topic or API.

    Output

  5. In the data map list, check the parsing status of the script.

    The Status column shows one of the following states:

    • Parsing Succeeded: The data map script was added successfully.

    • Parsing Failed:

      1. Click Download Failure Reason and correct the script based on the error message in the downloaded file.

      2. Find the data map, click Edit in the Actions column, re-upload the corrected script, and click OK.

Next steps

After a physical device reports data, you can view the following:

  • The property data of a digital twin node:

    1. In the left-side navigation pane, click Digital Twin Graph.

    2. On the Digital Twin Graph tab, click a digital twin node.

    3. In the TSL Model Data panel, view the property data of the node.

      Turn on the Real-time Refresh switch to see data updated in real time.

      The property data table includes the Property identifier, Property name, Data type, Update time, Latest value, and Actions columns. You can use the search box to filter properties by name or identifier, and switch between grid and list views.

  • View the operational logs for each digital twin node. For instructions, see View operational logs of a digital twin.