> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arc.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CSV Map Connector

> Transforms flat XML files into CSV, TSV, and PSV formats using a visual Designer or ArcScript Code view for complex mappings.

export const NameDescription = ({extraRows}) => <table>
    <thead>
      <tr>
        <th>設定</th>
        <th>説明</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><strong>Connector Id</strong></td>
        <td>コネクタの静的で一意の識別子です。</td>
      </tr>
      <tr>
        <td><strong>Connector Type</strong></td>
        <td>コネクタ名とその機能の説明を表示します。</td>
      </tr>
      <tr>
        <td><strong>Connector Description</strong></td>
        <td>コネクタおよびフロー内でのその役割について自由形式の説明を提供するためのオプションフィールドです。</td>
      </tr>
      {extraRows}
    </tbody>
  </table>;

export const SlasTab = ({siteName = "CData Arc"}) => <>
    <p><em>サービスレベルアグリーメント（SLA）の設定に関する設定です。</em></p>
    <p>
      SLA を使用すると、フロー内のコネクタが送受信すると見込まれるボリュームを設定し、そのボリュームを達成すると見込まれる期間を設定できます。{siteName} は、SLA が達成されない場合にユーザーへ警告するメールを送信し、SLA を<em>At Risk</em> としてマークします。これは、SLA が間もなく達成されない場合に<em>Violated</em> としてマークされることを意味します。これにより、ユーザーは介入してSLA が達成されない理由を特定し、適切な対応を取る機会を得られます。At Risk 期間の終了時点でもSLA が達成されない場合、SLA はviolated としてマークされ、ユーザーに再度通知されます。
    </p>
    <p>
      SLA を定義するには、<strong>Expected Volume</strong> をオンに切り替え、<strong>Settings</strong> タブをクリックします。
    </p>
    <img src="/public/images/sla_empty.png" alt="SLA Empty" />
    <ul>
      <li>コネクタに送信と受信の個別のアクションがある場合は、ラジオボタンを使用してSLA がどちらの方向に適用されるかを指定します。</li>
      <li>ウィンドウの<strong>Expect at least</strong> 部分で、次を設定します。
        <ul>
          <li>処理を見込む最小トランザクション数（ボリューム）を設定します。</li>
          <li><strong>Every</strong> フィールドを使用して期間を指定します。</li>
          <li>SLA を有効にするタイミングを指定します。<strong>Starting on</strong> を選択した場合は、日付および時刻フィールドを入力します。</li>
          <li>SLA を有効にしたい曜日のチェックボックスをオンにします。必要に応じて、ドロップダウンで<strong>Everyday</strong> を選択します。</li>
        </ul>
      </li>
      <li>ウィンドウの<strong>Set status to 'At Risk'</strong> 部分で、SLA をAt Risk としてマークするタイミングを指定します。
        <ul>
          <li>デフォルトでは、SLA が違反状態になるまで通知は送信されません。これを変更するには、<strong>Send an 'At Risk' notification</strong> をオンにします。</li>
        </ul>
      </li>
    </ul>
    <p>
      次の例は、月曜日から金曜日まで毎日1000 件のファイルを受信すると見込むコネクタ向けに設定されたSLA を示しています。1000 件のファイルが受信されていない場合、期間の終了の1時間前にAt Risk 通知が送信されます。
    </p>
    <img src="/public/images/sla_defined.png" alt="SLA Configuration Example" />
    <Note>
      必要に応じてSLA アラートをオフにすることができます。これはメンテナンスウィンドウ中に役立ちます。navbar で<strong>Settings</strong> をクリックし、<strong>Alerts &gt; General Alerts</strong> に移動します。タブレットと鉛筆のアイコンをクリックして編集し、<strong>SLA Alerts</strong> 設定のチェックを外します。
    </Note>
  </>;

export const AlertsTab = ({siteNameShort = "Arc"}) => <>
    <p><em>アラートの設定に関する設定です。</em></p>
    <p>
      サービスレベルアグリーメント（SLA）を実行する前に、通知用のメールアラートをセットアップする必要があります。デフォルトでは、{siteNameShort} は<a href="/26.3/self-hosted/ja/getting-started/administration/settings/alerts">Alerts</a> タブのグローバル設定を使用します。このコネクタに別の設定を使用するには、<strong>Override global setting</strong> をオンに切り替えます。
    </p>
    <p>
      デフォルトではエラーアラートが有効になっており、エラーが発生するたびにメールが送信されます。これをオフにするには、<strong>Enable</strong> チェックボックスのチェックを外します。
    </p>
    <p>
      <strong>Subject</strong>（必須）を入力します。<strong>Allow {siteNameShort}Script in Subject</strong> をチェックすると、<strong>Subject</strong> フィールドで{siteNameShort}Script を使用できます。これを選択すると、<strong>{siteNameShort}Script エディタ</strong>ボタンが表示されます（<img src="/public/images/rest_arcscript_editor.png" alt="arcscript editor button" style={{
  display: 'inline',
  verticalAlign: 'middle',
  margin: 0
}} />）。
    </p>
    <p>
      必要に応じて<strong>Recipient</strong> のメールアドレスをカンマ区切りのリストで入力します。
    </p>
  </>;

export const Message = () => <>
    <p><em>Message 設定は、コネクタがメッセージを検索する方法と、処理後にメッセージを管理する方法を決定します。</em></p>
    <p><strong>Note：</strong> 以下の設定は非推奨となり、デフォルトで非表示になっています。以前に有効化またはデフォルト以外の値に設定されていたコネクタにのみ表示されます。処理済みファイルのコピーを保持するには、フロー内のコネクタを右クリックし、<strong>成功パスを表示</strong>を選択して、成功パスを<a href="/26.3/self-hosted/ja/connectors/file">File コネクタ</a>に接続してください。</p>
    <table>
      <thead>
        <tr><th>設定</th><th>説明</th></tr>
      </thead>
      <tbody>
        <tr>
          <td><strong>Sent フォルダに保存</strong>（非推奨）</td>
          <td>コネクタが処理したファイルをSent フォルダにコピーします。デフォルトで無効です。Sent フォルダに保存されたファイルは<a href="/26.3/self-hosted/ja/getting-started/administration/settings/encryption-at-rest">保存データの暗号化</a>の対象外です。</td>
        </tr>
        <tr>
          <td><strong>Sent フォルダのスキーム</strong>（非推奨）</td>
          <td>選択した時間間隔で<strong>Sent</strong> フォルダ内のファイルをグループ化します。<strong>Sent フォルダに保存</strong>が有効な場合のみ適用されます。</td>
        </tr>
      </tbody>
    </table>
  </>;

export const MiscConnector = () => <>
    <p><em>Miscellaneous 設定は、特定のユースケース向けの設定です。</em></p>
    <table>
      <thead>
        <tr>
          <th>設定</th>
          <th>説明</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td><strong>Other Settings</strong></td>
          <td>非表示のコネクタ設定をセミコロン区切りのリストで設定できます（例：<code>setting1=value1;setting2=value2</code>）。通常のコネクタのユースケースや機能では、これらの設定の使用は必要ありません。</td>
        </tr>
      </tbody>
    </table>
  </>;

export const Logging = () => <>
    <p><em>ログの作成と保存を制御する設定です。</em></p>
    <table>
      <thead>
        <tr>
          <th>設定</th>
          <th>説明</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td><strong>Log Level</strong></td>
          <td>コネクタが生成するログの詳細度です。サポートを依頼する際は、これを<strong>Debug</strong> に設定してください。</td>
        </tr>
        <tr>
          <td><strong>Log Subfolder Scheme</strong></td>
          <td>選択した間隔に従って、コネクタがLogs フォルダ内のファイルをグループ化するよう指示します。<strong>Weekly</strong> オプション（デフォルト）は、コネクタが毎週新しいサブフォルダを作成し、その週のすべてのログをそのフォルダに保存するよう指示します。この設定を空白のままにすると、コネクタはすべてのログをLogs フォルダに直接保存します。多数のトランザクションを処理するコネクタでは、サブフォルダを使用することでログを整理しやすくなり、パフォーマンスが向上します。</td>
        </tr>
        <tr>
          <td><strong>Log Messages</strong></td>
          <td>処理したファイルのログエントリにファイル自体のコピーを含めるには、これをオンにします。これを無効にすると、<strong>Transactions</strong> タブからファイルのコピーをダウンロードできなくなる場合があります。</td>
        </tr>
      </tbody>
    </table>
  </>;

export const MacrosExamples = ({extraMacros = []}) => <>
    <p>
      %Ext% や %ShortDate% などの一部のマクロは引数を必要としませんが、引数を必要とするものもあります。
      引数を取るすべてのマクロは次の構文を使用します。<code>%Macro:argument%</code>
    </p>

    <p>引数を取るマクロの例を次に示します。</p>

    <ul>
      <li>%Header:headername%：<code>headername</code> はメッセージ上のヘッダーの名前です。</li>
      <li>%Header:mycustomheader% は、入力メッセージに設定された<code>mycustomheader</code> ヘッダーの値に解決されます。</li>
      <li>%Header:ponum% は、入力メッセージに設定された<code>ponum</code> ヘッダーの値に解決されます。</li>
      <li>%RegexFilename:pattern%：<code>pattern</code> は正規表現パターンです。例えば、<code>%RegexFilename:^([\w][A-Za-z]+)%</code> は、ファイル名の最初の単語にマッチしてそれに解決され、大文字・小文字を区別しません（<code>test_file.xml</code> は<code>test</code> に解決されます）。</li>
      <li>%Vault:vaultitem%：<code>vaultitem</code> は<a href="/26.3/self-hosted/ja/getting-started/administration/settings/global-settings-vault">Vault</a> 内のアイテムの名前です。例えば、<code>%Vault:companyname%</code> は、Vault に保存された<code>companyname</code> アイテムの値に解決されます。</li>
      <li>%DateFormat:format%：<code>format</code> は許容される日付形式です（詳細は<a href="/26.3/self-hosted/ja/scripting/value-formatters/date-formatters#sample-date-formats">日付形式のサンプル</a>を参照してください）。例えば、<code>%DateFormat:yyyy-MM-dd-HH-mm-ss-fff%</code> は、ファイルの日付とタイムスタンプに解決されます。</li>
      {extraMacros.filter(item => item.example).map(item => <li key={`ex-${item.name}`}>{item.example}</li>)}
    </ul>

    <p>次の例に示すように、より高度なマクロを作成することもできます。</p>

    <ul>
      <li>1 つのファイル名で複数のマクロを組み合わせる：<code>%DateFormat:yyyy-MM-dd-HH-mm-ss-fff%%EXT%</code></li>
      <li>マクロの外側にテキストを含める：<code>MyFile_%DateFormat:yyyy-MM-dd-HH-mm-ss-fff%</code></li>
      <li>マクロの内側にテキストを含める：<code>%DateFormat:'DateProcessed-'yyyy-MM-dd_'TimeProcessed-'HH-mm-ss%</code></li>
    </ul>
  </>;

export const MacrosTable = ({siteName = "CData Arc", extraMacros = []}) => <>
    <p>
      ファイル命名戦略でマクロを使用すると、データの整理効率と文脈の理解を高めることができます。
      ファイル名にマクロを組み込むことで、識別子、タイムスタンプ、ヘッダー情報などの関連情報を
      動的に含めることができ、各ファイルに有用な文脈を提供します。
    </p>

    <p>{siteName} は次のマクロをサポートしています。これらはすべて次の構文を使用します。<code>%Macro%</code></p>

    <table>
      <thead>
        <tr><th>マクロ</th><th>説明</th></tr>
      </thead>
      <tbody>
        <tr><td>ConnectorID</td><td>コネクタのConnectorID に評価されます。</td></tr>
        <tr><td>ConnectorName</td><td>コネクタの名前に評価されます。ファイル名やパスに接続名を含めることができます。例えば、どのデータベース接続が生成したかによってバックアップファイルにタグを付けるために使用できます。</td></tr>
        <tr><td>Ext</td><td>コネクタが現在処理しているファイルの拡張子に評価されます。</td></tr>
        <tr><td>Filename</td><td>コネクタが現在処理しているファイルのファイル名（拡張子を含む）に評価されます。</td></tr>
        <tr><td>FilenameNoExt</td><td>コネクタが現在処理しているファイルのファイル名（拡張子を除く）に評価されます。</td></tr>
        <tr><td>MessageId</td><td>コネクタが出力しているメッセージのMessageId に評価されます。</td></tr>
        <tr><td>RegexFilename:<em>pattern</em></td><td>コネクタが現在処理しているファイルのファイル名に正規表現パターンを適用します。</td></tr>
        <tr><td>Header:<em>headername</em></td><td>コネクタが現在処理しているメッセージ上の対象ヘッダー（<code>headername</code>）の値に評価されます。</td></tr>
        <tr><td>LongDate</td><td>システムの現在の日時を長い形式（例：Wednesday, January 24, 2024）で評価します。</td></tr>
        <tr><td>ShortDate</td><td>システムの現在の日時をyyyy-MM-dd 形式（例：2024-01-24）で評価します。</td></tr>
        <tr><td>DateFormat:<em>format</em></td><td>システムの現在の日時を指定された形式（<code>format</code>）で評価します。利用可能な日時形式については、<a href="/26.3/self-hosted/ja/scripting/value-formatters/date-formatters#date-formats-with-literal-characters">日付形式のサンプル</a>を参照してください。</td></tr>
        <tr><td>Vault:<em>vaultitem</em></td><td>指定されたVault アイテムの値に評価されます。</td></tr>
        {extraMacros.map(item => <tr key={item.name}>
            <td>{item.name}</td>
            <td>{item.description}</td>
          </tr>)}
      </tbody>
    </table>
  </>;

export const Performance = () => <>
    <p><em>コネクタへのリソースの割り当てに関する設定です。</em></p>
    <table>
      <thead>
        <tr>
          <th>設定</th>
          <th>説明</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td><strong>Max Workers</strong></td>
          <td>このコネクタでファイルを処理するためにスレッドプールから消費されるワーカースレッドの最大数です。設定すると、<a href="/26.3/self-hosted/ja/getting-started/administration/settings/advanced-settings">Advanced Settings</a> ページの<a href="/26.3/self-hosted/ja/getting-started/administration/settings/performance-settings">Performance Settings</a> 部分にあるデフォルト設定が上書きされます。</td>
        </tr>
        <tr>
          <td><strong>Max Files</strong></td>
          <td>コネクタに割り当てられた各スレッドが送信するファイルの最大数です。設定すると、<a href="/26.3/self-hosted/ja/getting-started/administration/settings/advanced-settings">Advanced Settings</a> ページの<a href="/26.3/self-hosted/ja/getting-started/administration/settings/performance-settings">Performance Settings</a> 部分にあるデフォルト設定が上書きされます。</td>
        </tr>
      </tbody>
    </table>
  </>;

export const siteNameShort = "Arc";

export const siteName = "CData Arc";

The CSV Map connector uses {siteNameShort}Script to transform flat XML files into CSV, TSV, and PSV file formats. A flat XML file is one where, in addition to the root element, the depth is not more than two levels.

## Key Capabilities

* Transforms flat XML files into CSV, TSV, and PSV formats using ArcScript templating
* Visual Designer for simple mappings with automatic field matching and Code view for complex transformations
* XPath navigation for extracting values from nested XML structures with dynamic template generation

## Overview

The CSV Map connector has two modes of operation: the visual **Designer** and the scripting-focused **Code** view. The Designer enables you to visually establish simple relationships between document types. More complicated translations require the Code view, which leverages the {siteNameShort}Script scripting language to create a mapping template between XML and a flat file structure.

To begin, from the **Settings** tab, upload a sample **Source File** and **Destination File**. If the structure of both sample files allows for designer-driven mapping, the visual Designer is populated with the source and destination fields. The application also attempts to populate the Code window with as much of the destination structure as it can.

## Connector Configuration

This section contains all of the configurable connector properties.

### Mapping Tab

*Upload files to initiate design-driven mapping of source and destinations fields.*

Click **Upload File**, then choose your source and destination files.

* The **Source File** represents the XML structure of input documents. Any files processed by the connector should have a matching XML structure. To support designer-driven mapping, this file must be a simple XML, CSV, PSV, or TSV structure.
* The **Destination File** file represents the structure of output documents. To use designer-driven mapping, this file must be a simple XML, CSV, PSV, or TSV structure.

#### Mappings

This section defines the mapping relationship between input and output files. The Designer view can map simple XML, CSV, PSV, and TSV structures, and the Code view can map more complicated XML structures. See [Using the Designer](#using-the-designer) and [Using Code View](#using-the-code-view) for details.

### Settings Tab

#### Connector Configuration

*Settings related to the core operation of the connector.*

<NameDescription />

### Advanced Tab

#### Advanced Settings

| Setting               | Description                                                                                                                                                                                                                                                                              |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Processing Delay**  | The amount of time (in seconds) by which the processing of files placed in the **Transactions** tab is delayed. This is a legacy setting. Best practice is to [use a File connector](../flows/designing-a-flow#ローカルファイルシステムとのやり取り) to manage local file systems instead of this setting. |
| **Local File Scheme** | A scheme for assigning filenames to messages that are output by the connector. You can use macros in your filenames dynamically to include information such as identifiers and timestamps. For more information, see [Macros](#macros).                                                  |

#### Message

<Message />

#### Logging

<Logging />

#### Miscellaneous

<MiscConnector />

### Automation Tab

#### Automation Settings

*Settings related to the automatic processing of files by the connector.*

| Setting  | Description                                                             |
| -------- | ----------------------------------------------------------------------- |
| **Send** | Whether messages arriving at the connector are automatically processed. |

#### Performance

<Performance />

### Alerts Tab

<AlertsTab />

### SLAs Tab

<SlasTab />

## Using the Designer

The visual designer is only available for CSV, PSV, TSV, and simple XML files. Below is an example of a simple XML document as the source file:

```xml theme={null}
<actor table="actor">
  <actor_id key="true">124455</actor_id>
  <first_name>Bob</first_name>
  <last_name>Smith</last_name>
</actor>
```

This source file might be paired with the following CSV document as the destination file:

```csv theme={null}
id,first name,last name,time
124455,Bob,Smith,2017-07-18T17:38:53-04:00
```

When these files are configured as the source and destination files, the designer displays rows in the **Source** column for each row in the source file (actor\_id, first\_name, and last\_name). For each field in the source, use the dropdown to select the appropriate **Destination** column. The application automatically attempts to match the source and destination fields based on the column names. In the above example, the *actor\_id* row would automatically be matched with the *id* column.

<img src="https://mintcdn.com/cdata-arc/AKthyJ-LnqphL8js/public/images/map_connector_designer.png?fit=max&auto=format&n=AKthyJ-LnqphL8js&q=85&s=741218ed7a9be6221d2e0dfd7bf3663a" alt="Mapping Designer" width="1904" height="976" data-path="public/images/map_connector_designer.png" />

## Using the Code View

The Code view provides the ability to generate the mapping template manually using {siteNameShort}Script. This allows for more granular control over the possible input and output formats. The code view defines how the destination file looks once rendered, with {siteNameShort}Script elements dynamically filling in the template with values from the source document. {siteNameShort}Script elements all start with an *arc* prefix: for example, `<arc:set>`. Any content in the code view that is not {siteNameShort}Script is included as part of the output file.

### Navigating XML Input

{siteNameShort}Script supports navigating complicated XML structures to parse out values from the Source File. The [xmlDOMSearch](../scripting/operations/op-xml-dom-search) operation takes an xpath as input and loads the XML structure at the given path. This operation loops for each instance of the xpath found in the source document: to load the entire document and avoid looping, provide the root element of the XML source as input to [xmlDOMSearch](../scripting/operations/op-xml-dom-search). For example:

```xml theme={null}
<arc:call op=xmlDOMSearch?xpath=/root>
  <!-- Inside this operation call the parsed XML elements can be accessed -->
</arc:call>
```

Once the XML document is loaded, the [xpath formatter](../scripting/value-formatters/function-formatters#xpath-xpath) supports reading out values from the XML at the specified xpath. This formatter accepts absolute xpaths as well as xpaths relative to the path loaded by [xmlDOMSearch](../scripting/operations/op-xml-dom-search). The xpath formatter, like all formatters, can only be used in square brackets \[]. For example:

```xml theme={null}
<arc:call op="xmlDOMSearch?xpath=/root/author">
  [xpath('name')]
</arc:call>
```

Take the following simple XML as an example input to the above script:

```xml theme={null}
<root>
  <author>
    <name>Stephen King</name>
  </author>
  <author>
    <name>Kurt Vonnegut</name>
  </author>
</root>
```

In this example, the [xmlDOMSearch](../scripting/operations/op-xml-dom-search) operation loops over each `author` element in the `root`. Within each `author` loop, the value from the `name` element is read as content in the output file. The output file in this case would look like this:

```
Stephen King
Kurt Vonnegut
```

### Templating Output Data

The Code view serves as a template of the output file, and {siteNameShort}Script fills in the values to the defined template. As a simple example, if data is formatted as comma-separated values, these commas can be included as part of the Code view to provide structure to the {siteNameShort}Script functions. Therefore, you can generate more complex CSV files from more complicated XML structures than the Designer mode allows.

For example, take the following XML, which has nested elements that prevent the use of Designer mode:

```xml theme={null}
<actor table="actor">
  <actor_id key="true">12445</actor_id>
  <name>
    <first_name>Viggo</first_name>
    <last_name>Mortensen</last_name>
  </name>
  <actor_id key="true">12522</actor_id>
  <name>
    <first_name>Gal</first_name>
    <last_name>Gadot</last_name>
  </name>
</actor>
```

The nested elements can be retrieved by passing the appropriate paths to {siteNameShort}Script's [xpath formatter](../scripting/value-formatters/function-formatters#xpath-xpath). These formatters can be placed in commas and after header names to provide the desired CSV structure, and an additional [csvescape formatter](../scripting/value-formatters/encoding-decoding-string-formatters#csvescape) ensures that the values are properly quoted:

```xml theme={null}
id,first name,last name
<arc:call op="xmlDOMSearch?xpath=actor">
[xpath('actor_id') | csvescape],[xpath('name/first_name') | csvescape],[xpath('name/last_name') | csvescape]
</arc:call>
```

You can generate a wide range of text files with this mix of templating data and {siteNameShort}Script calls.

### Additional Scripting Features

Since full {siteNameShort}Script is available in Code view, you might want to leverage {siteNameShort}Script [Operations](../scripting/operations/operations) in the template. For example, if the source file only includes the Id of an item in the database, but you need the actual item name, you can use the [dbQuery](../scripting/operations/op-db-query) operation to look up the name for the corresponding Id.

{siteNameShort}Script also supports conditional logic in a mapping template. The `arc:if` keyword is one of many keywords available to help with performing conditional logic in templates. For example, if the source file contains information about customers in QuickBooks, you might want to perform different business logic for customers with an outstanding balance versus customers who have paid in full. A simple example of this use case might look like the following:

```xml theme={null}
<arc:set item="Customer" attr="paidinfull" value="true" />
<arc:call op="xmlDOMSearch?xpath=Customer">
  <arc:if exp="[xpath('balance')] > 0">
    <arc:set item="Customer" attr="paidinfull" value="false" />
  </arc:if>
</arc:call>
id,first name,last name, paid in full
[xpath('customer_id') | csvescape],[xpath('first_name') | csvescape],[xpath('last_name') | csvescape],[Customer.paidinfull]
```

## Macros

<MacrosTable />

### Examples

<MacrosExamples />
