---
schema_version: "1"
id: 22ac55f7beb35f20e133e13ce26bce91d01c3cb6416d46e12648d38f3c8c184b
title: then
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.6/dw-core-functions-then.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.6/dw-core-functions-then
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 84eab8affe0991c375323c3df12b9b8d8c355eff1d232c9a91d5175388c39e4c
description: MuleSoft Documentation Site
release: "2.6"
latest: false
---
# then

## [](#then1)then(value: Null, callback: (previousResult: Nothing) -> Any): Null

`then`​ を ​`null`​ 値に使用できるようにするヘルパー関数。

_DataWeave バージョン 2.4.0 で導入されました。_

## [](#then2)then<T, R>(previous: T, callback: (result: T) -> R): R

この関数は、前の式から返された値が ​`null`​ でない場合のみ前の式から返された値を次 (コールバック) に渡すパイプとして機能します。

_DataWeave バージョン 2.4.0 で導入されました。_

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>previous</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">前の式の値。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>callback</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">結果が ​<code>null</code>​ でない場合に ​<code>previous</code>​ の結果を処理するコールバック。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、​`then`​ を使用して前の式の結果を連結してその処理を続行する方法を示しています。

#### [](#ソース)ソース

```DataWeave
%dw 2.0
output application/json
---
{
    "chainResult": ["mariano", "de Achaval"]
            reduce ((item, accumulator) -> item ++ accumulator)
            then ((result) -> sizeOf(result)),
    "referenceResult" : ["mariano", "de Achaval"]
                         map ((item, index) -> upper(item))
                         then {
                            name: $[0],
                            lastName: $[1],
                            length: sizeOf($)
                        },
    "onNullReturnNull": []
                reduce ((item, accumulator) -> item ++ accumulator)
                then ((result) -> sizeOf(result))
}
```

#### [](#出力)出力

```Json
{
   "chainResult": 17,
   "referenceResult": {
     "name": "MARIANO",
     "lastName": "DE ACHAVAL",
     "length": 2
   },
   "onNullReturnNull": null
 }
```