# If..then..elseif..else..end if

if..then 制御ステートメントは、1 つ以上の論理条件に応じて異なるパスに従うようスクリプトを強制実行させるスクリプト選択構文です。

通常、制御ステートメントはスクリプト実行の流れを制御するために使用されます。チャートの数式では、代わりに if 条件分岐関数を使用してください。詳細については [if - スクリプトおよびチャート関数](https://help.qlik.com/ja-JP/qlikview/September2025/Subsystems/Client/Content/QV_QlikView/Scripting/ConditionalFunctions/if.htm) を参照してください。

構文:

If condition then

[ statements ]

{ elseif condition then

[ statements ] }

[ else

[ statements ] ]

end if

if..then ステートメントは制御ステートメントであり、セミコロンまたは改行コードで終わっているため、使用可能な 4 つの節 (if..then、elseif..then、else、end if) が行をまたぐことはできません。

引数：

If 引数

| 引数 | 説明 |
| --- | --- |
| condition | True か False で評価できる論理式です。 |
| statements | 1 つ以上の QlikView スクリプト ステートメントのグループ。 |

例1：

`if a=1 then`

> `LOAD * from 
>  abc.csv;` `SQL SELECT 
>  e, f, g from tab1;`

`end if`

例2：

`if a=1 then; 
 drop table xyz; end if;`

例3：

`if x>0 
 then`

> `LOAD * from 
>  pos.csv;`

`elseif 
 x<0 then`

> `LOAD * from 
>  neg.csv;`

`else`

> `LOAD * from 
>  zero.txt;`

`end 
 if`

## 詳細を見る

* [End](https://help.qlik.com/ja-JP/qlikview/September2025/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptControlStatements/End.htm)