ループの分割 - 8.0

Talend Data Mapperユーザーガイド

Version
8.0
Language
日本語
Product
Talend Big Data Platform
Talend Data Fabric
Talend Data Management Platform
Talend Data Services Platform
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
ジョブデザインと開発 > ジョブデザイン
Last publication date
2024-03-28

ループが2つのループに分割されます。

始める前に

入力ストラクチャーと出力ストラクチャーを持つマップを作成済みであること。この例ではループを展開と同じマップを使います。

このタスクについて

この例では、入力Componentエレメントをマッピング済みであり、自分の出力ストラクチャーにComponentsと同じレベルで2つの再帰SubComponentsループを含めます。

手順

  1. 前の例で作成されたマップを使用している場合は、出力Components[2]エレメントを右クリックして[Remove Expressions (Mappings)] (式の削除(マッピング))をクリックします。
  2. 入力ストラクチャーで再帰SubComponentsループを展開し、ループの2つのレベルをその子と共に表示させます。
    マップは次のようになります。
  3. Components[2]ループを右クリックして[Split Loop] (ループの分割)をクリックします。
    これによって同じレベルに同一の新しいループが作成されます。
  4. 最初の入力SubComponentsループを出力Components[2]にドラッグします。
    エレメントがマッピングされ、SimpleLoopファンクションが出力ルーピングエレメントに追加されます。
  5. 子の入力SubComponentsループを出力Components[3]にドラッグします。
    エレメントがマッピングされ、SimpleLoopNestedContextと共に出力ルーピングエレメントに追加されます。

タスクの結果

ループがマッピングされます。サンプル入力ファイルに基づいて出力を確認する場合は、[Test Run] (テスト実行)ボタンを使います。この例での出力は次のようになります。
<FlatComponents>
  <Row>
    <Components>
      <Id>1</Id>
      <PartNumber>45I1122</PartNumber>
      <Quantity>1</Quantity>
      <Description>Main Component</Description>
    </Components>
    <Components>
      <Id>102</Id>
      <PartNumber>12ZSSS</PartNumber>
      <Quantity>5</Quantity>
      <Description>Door Assembly</Description>
    </Components>
    <Components>
      <Id>302</Id>
      <PartNumber>12IQWO</PartNumber>
      <Quantity>14</Quantity>
      <Description>Window Assembly</Description>
    </Components>
    <Components>
      <Id>201</Id>
      <PartNumber>88-B</PartNumber>
      <Quantity>2</Quantity>
      <Description>Hinge</Description>
    </Components>
    <Components>
      <Id>202</Id>
      <PartNumber>GF4488-B</PartNumber>
      <Quantity>1</Quantity>
      <Description>Lock</Description>
    </Components>
    <Components>
      <Id>203</Id>
      <PartNumber>288333-I10023</PartNumber>
      <Quantity>1</Quantity>
      <Description>Sign</Description>
    </Components>
    <Components>
      <Id>401</Id>
      <PartNumber>88-C</PartNumber>
      <Quantity>2</Quantity>
      <Description>Window Lock</Description>
    </Components>
    <Components>
      <Id>402</Id>
      <PartNumber>RT433</PartNumber>
      <Quantity>1</Quantity>
      <Description>Window Frame</Description>
    </Components>
    <Components>
      <Id>403</Id>
      <PartNumber>15</PartNumber>
      <Quantity>1</Quantity>
      <Description>Glass</Description>
    </Components>
  </Row>
</FlatComponents>