> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/experience-cloud/experience-cloud-ja/chtoriaru/reactive-components/linked-data-tables.md).

# リンクされたデータテーブル

## テーブルを同期させる

ページに 2 つのテーブルがあると想像してください:

1. **アカウントテーブル:** このテーブル（`accountsDatatable`）には、すべての顧客アカウントが一覧表示されます。
2. **連絡先テーブル:** このテーブル（`contactsDatatable`）には、アカウントに紐づくすべての連絡先が一覧表示されます。

**目標:** アカウントテーブルでアカウントを選択したとき、連絡先テーブルが自動的に更新され、 *その特定の* アカウントに対する連絡先だけを表示するようにしたいのです。

## **実現方法**

### **アカウントテーブル**

* Avonni データテーブルコンポーネントをドラッグします
* このテーブルに API 名を設定したことを確認してください `accountsDatatable`.
* Query Data Source を使用してデータソースを設定します
* Accounts オブジェクトを選択します
* 列を作成するためにデータマッピングを設定します

<figure><img src="https://9391847-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDL6JQuZArjJeQvX2ot4y%2Fuploads%2Fgit-blob-6c5c0db82baf8877ee1102d13e33bb64c965c1aa%2F2024-05-28_20-33-37.png?alt=media" alt=""><figcaption></figcaption></figure>

### **連絡先テーブル**

* このテーブルも設定されており、すべての連絡先が表示されています。
* テーブルの設定で「Data Source」セクションに移動します。
* 「Query Data Source」オプションを選択します。
* 連絡先情報を保持しているオブジェクト（例: 「Contact」）を選択します。
* フィルター条件を追加します:
  * フィールド： `Account Id` （または、連絡先をアカウントに関連付ける任意のフィールド）
  * 演算子： `等しい`
  * 値： `{{accountsDatatable.selectedRecord.Id}}`
    * この式コードは、連絡先テーブルに対して、Account ID がアカウントテーブルで選択された行の ID と一致する連絡先だけを表示するよう指示します。
* フィールドを追加して列を作成します。

### **結果**

* ユーザーはアカウントテーブルでアカウント一覧を閲覧します。
* アカウントをクリックします。
* 連絡先テーブルは即座に更新され、選択したアカウントに関連する連絡先だけが表示されます。

これにより、テーブルが同期され、スムーズで直感的なユーザー体験を提供できます。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/experience-cloud/experience-cloud-ja/chtoriaru/reactive-components/linked-data-tables.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
