> ## Documentation Index
> Fetch the complete documentation index at: https://help.dingtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Catalog

> Learn how to use the built-in Data Catalog connector in YiDA to retrieve instant messaging group chat statistics for your organization, including group chat users, new groups, active groups, and more. This guide walks you through the entire process, from form design to data submission and result display.

<Warning>
  This feature can only query data from before the current date.

  For example, if today is December 1, 2021, you can only query data prior to December 1.
</Warning>

## 1. Use Cases

With this connector, you can retrieve the following organizational group chat statistics:

* Group chat users: the number of users who sent group chat messages within the organization.
* New groups: the number of new Internal Groups created within the organization.
* Active groups: the number of Internal Groups in which messages were sent within the organization.
* Group chat messages: the number of messages sent in Internal Groups within the organization.
* Internal Groups: the current number of Internal Groups within the organization.
* Department Chats: the current number of Department Chats.

## 2. Procedure

### 2.1 Step 1: Design the Forms

Create two forms — one to trigger the connector, and the other to receive and display the data returned by the connector.

#### 2.1.1 Create the "Query Organization Group Chat Statistics" Form

**Steps:**

1. Create a regular form and name it "Query organization group chat statistics".
2. Add a Date component, name it "Query date", and mark it as required. (See Figure 2.1-1)

Figure 2.1-1 Add and configure the Date component

1. Click **Save** in the upper-right corner of the page.

#### 2.1.2 Create the "Organization Group Chat Data Details" Form

**Steps:**

1. Create a regular form and name it "Organization group chat data details".
2. Add a Multi-line text component, name it "Returned data", and set its state to "Hidden". (See Figure 2.1-2)

Figure 2.1-2 Add and configure the Multi-line text component

3. Add a subform component, name it "Organization group chat statistics details table", and set its state to "Read-only". (See Figure 2.1-3)

Figure 2.1-3 Add and configure the subform component

4. Inside the subform, add 7 Single-line text components and name them "Query date, Group chat users, New groups, Active groups, Group chat messages, Internal Groups, Department Chats". Set all of their states to "Read-only". (See Figure 2.1-4)

Figure 2.1-4 Add and configure the 7 Single-line text components inside the subform

5. Add the following code to the JS panel to process the data. (See Figure 2.1-5)

Figure 2.1-5 Add JS code to process the data

The code is as follows:

Be sure to replace the unique identifiers of the components.

```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
export function didMount() {
  // Get the data returned by the connector. "textareaField_ky16z248" is the unique identifier of the Multi-line text component. Be sure to replace it, otherwise it will not work!
  const str = this.$("textareaField_ky16z248").getValue();
  // Process the data
  const obj = JSON.parse(str);
  const val = obj.dataList;
  let arr = [];
  const valList = val.map(item => {
    let valObject = {};
    // Query date
    // Replace textField_ky16z24k with the unique identifier of the component you created
    valObject.textField_ky16z24k = item["stat_date"];
    // Group chat users
    // Replace textField_ky16z24l with the unique identifier of the component you created
    valObject.textField_ky16z24l = item["4030_DAY"];
    // New groups
    // Replace textField_ky16z24j with the unique identifier of the component you created
    valObject.textField_ky16z24j = item["4031_DAY"];
    // Active groups
    // Replace textField_ky16z24i with the unique identifier of the component you created
    valObject.textField_ky16z24i = item["4032_DAY"];
    // Group chat messages
    // Replace textField_ky16z24h with the unique identifier of the component you created
    valObject.textField_ky16z24h = item["4033_DAY"];
    // Internal Groups
    // Replace textField_ky16z24g with the unique identifier of the component you created
    valObject.textField_ky16z24g = item["4034_DAY"];
    // Department Chats
    // Replace textField_ky16z24f with the unique identifier of the component you created
    valObject.textField_ky16z24f = item["4035_DAY"];
    arr.push(valObject);
  })
  // Assign the processed data to the subform component
  // Replace tableField_ky16z24a with the unique identifier of the subform component you created
  this.$("tableField_ky16z24a").setValue(arr);
}
```

6. Click **Save** in the upper-right corner of the page.

### 2.2 Step 2: Add the Connector

For a detailed introduction to connectors, see [Introduction to Integration & Automation](/yida/integration/gqmveiswrxkgxu9s).

Add a connector to the "Query organization group chat statistics" form to integrate with the DingTalk Data Catalog connector.

**Steps:**

1. On the Admin page, select the "Query organization group chat statistics" form, choose **Integration & Automation**, and then click **Create Integration & Automation**. (See Figure 2.2-1)

Figure 2.2-1 Connector entry point

2. Create a connector named "Query organization statistics". Select "Form event trigger" as the Trigger type, and then click **Confirm**.

(See Figure 2.2-2)

Figure 2.2-2 Create the connector

3. Configure the form event trigger: select "Create success" as the trigger event, select "All data" for data filtering, and then click **Save**.

(See Figure 2.2-3)

Figure 2.2-3 Configure the form event trigger for the connector

4. Select the app > **Data Catalog** > **Next**. (See Figure 2.2-4)

Figure 2.2-4 Select the connector app

5. Select the action > **Get organization group chat statistics** > **Next**. (See Figure 2.2-5)

Figure 2.2-5 Select the connector action

6. Configure the action > Query time > **Field** > **Query date** > **Save**. (See Figure 2.2-6)

Figure 2.2-6 Configure the connector action

7. Add a Create Data node. In the "Receive organization group chat statistics" form, create a single record and set the value of "Connector returned data" to "Business result" > "Field". (See Figure 2.2-7)

Figure 2.2-8 Add and configure the Create Data node

8. Click **Save** in the upper-right corner of the page, and then click **Publish**.

### 2.3 Step 3: Submit the Form Data

**Steps:**

Submit the "Query organization group chat statistics" form to trigger the connector. You can view the connector's response in the "Organization group chat statistics details" form. (See Figure 2.3-1)

Figure 2.3-1 Submit the form

## 3. Result

**Path**: Admin page > "Organization group chat data details" > Data management > View details. (See Figure 3.1 for the final result.)

Figure 3.1 Final result of the connector
