---
schema_version: "1"
id: f77a39dd66ece1b3ba587e83fd3a04bad5fba534347731f4f01f919a50fedbf2
title: "Transform カードを使用したマッピングの例 (Flow Designer):page-support-status: eolScheduled"
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/design-center/fd-mapping-examples.md
canonical_url: https://docs.mulesoft.com/jp/design-center/fd-mapping-examples
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 077397d24fc6c6fe2f3e7dd3a859a4693898b2518bf554eed9d995b6a89c053e
description: MuleSoft Documentation Site
latest: true
---
# Transform カードを使用したマッピングの例 (Flow Designer):page-support-status: eolScheduled

チュートリアル​[「Flow Designer での最初の Mule アプリケーションの作成」](https://docs.mulesoft.com/jp/design-center/salesforce-to-twilio)​の手順を実行したユーザーは、すでに 2 回のマッピングを行っています。この両方のマッピングをもう一度見てみましょう。

## [](#最初の例)最初の例

初回は、Choice カードの出力を、NTO Order API で必要とされる入力にマップする必要がありました。

<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 1. Choice カードで出力されるデータ型と NTO Order API で必要とされるデータ型</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Choice カードで出力されるデータ型</th>
<th class="tableblock halign-left valign-top">NTO Order API で入力として必要とされるデータ型</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="listingblock">
<div class="title">Product Information (製品情報) データ型</div>
<div class="content">
<pre>[
  {
    "productID": string,
    "category": string,
    "SKU": string,
    "productName": string,
    "inventory": string
  }
]</pre>
</div>
</div>
<div class="listingblock">
<div class="title">Salesforce Opportunity (Salesforce 商談) データ型</div>
<div class="content">
<pre>{
  "Amount": number,
  "Id": string,
  "CloseDate": string,
  "Name": string
}</pre>
</div>
</div></div></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="listingblock">
<div class="title">Order Information (注文情報) データ型</div>
<div class="content">
<pre>{
  "OppId": string,
  "OrderAmount": number,
  "orderdate": string,
  "productInfo": {
     "productID": string,
     "category": string,
     "SKU": string,
     "productName": string,
     "inventory": number
     }
}</pre>
</div>
</div></div></td>
</tr>
</tbody>
</table>

マッピングを行うため、Transform カードを使用して、​**\[Input (入力)\]**​ 側の要素をクリックして ​**\[Output (出力)\]**​ 側の要素にドラッグしました。(Transform カードの「入力」と「出力」は Transform カード自体を基準とする相対的な用語です。Transform カードへの「入力」は Choice カードの出力であり、Transform カードの「出力」は Order API への入力です)。

![transform first final](/mulesoft/current/ja-jp/design-center/_images/transform-first-final.png)

Figure 1. Choice カードの出力を、API で必要とされる入力にマップする Transform カード

Order API (POST メッセージの送信先の REST API) は Choice カードの出力に含まれる一部のデータを必要としなかったため、マッピングを行う必要がありました。また、API で必要とされるデータの一部の要素の名前が、Choice カードの出力内の対応する要素とは異っていました。

<table class="tableblock frame-all grid-all stretch">
<caption class="title">Table 2. Choice カードのデータを Order API のデータにマッピングするための要件</caption>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Choice カードの要素</th>
<th class="tableblock halign-left valign-top">マップ先の Order API の要素</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>productID</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>productID</code>​</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>category</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>category</code>​</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SKU</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>SKU</code>​</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>productName</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>productName</code>​</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>inventory</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>inventory</code>​</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Amount</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>OrderAmount</code>​</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Id</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>OppId</code>​</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>CloseDate</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>orderDate</code>​</p></td>
</tr>
</tbody>
</table>

## [](#2-番目の例)2 番目の例

チュートリアルの 2 回目のマッピングでは、Twilio カードの入力に対してデータ型を明示的に設定する必要はありませんでした。Twilio カードで必要とされるデータ構造を Transform カードで判別することができました。また、データ要素もマップしませんでした。代わりに、Transform カードの出力で DataWeave スクリプトを使用して、Transform カードの入力から、顧客に送信するメッセージにデータを取り込みました。また、​`To`​ および ​`From`​ 項目の値を特定の電話番号に明示的に設定しました。これは、Transform カードの ​**\[Script (スクリプト)\]**​ ペインで確認できます。

![transform second script panel](/mulesoft/current/ja-jp/design-center/_images/transform-second-script-panel.png)

Figure 2. Transformation カードへの入力のデータを使用する DataWeave スクリプトと、​`To`​ および ​`From`​ 項目の電話番号が示されている Transform カードの ​**\[Script (スクリプト)\]**​ ペイン

**\[Mappings (マッピング)\]**​ ペインには次のビューが表示されました。

![transform second mappings panel](/mulesoft/current/ja-jp/design-center/_images/transform-second-mappings-panel.png)

Figure 3. マッピングのビューが表示されている Transform カードの ​**\[Mappings (マッピング)\]**​ ペイン

出力ペイロードの 3 つの項目に付けられた ​`f(x)`​ マーカーは、これらの項目に、文字列または DataWeave 式を介して提供された値が入力されていることを示します。入力ペイロードの ​`OrderID`​、​`TrackingNo`​、および ​`ETA`​ が出力ペイロードの ​`Body`​ にすべてマップされています。これは、​`Body`​ のスクリプトがこの 3 つのペイロード要素を参照するためです。

## [](#関連情報)関連情報

- [カードの出力を次のカードの必須入力にマップ](https://docs.mulesoft.com/jp/design-center/fd-transform)
- [Transform カードツアー](https://docs.mulesoft.com/jp/design-center/fd-tour-transform-card)
- [変換用のデータ型のマッピングに関する推奨事項の入手](https://docs.mulesoft.com/jp/design-center/get-mapping-recommendations)