# 邏輯函數

本節說明處理邏輯操作的函數。所有函數皆可用於資料載入指令碼和圖表運算式。

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/LogicalFunctions/logical-functions.htm)

#### IsNum

如果運算式可解譯為數字，會傳回 -1 (True)，否則會傳回 0 (False)。

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/LogicalFunctions/logical-functions.htm)[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/LogicalFunctions/logical-functions.htm)IsNum( expr )

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/LogicalFunctions/logical-functions.htm)

#### IsText

如果運算式有文字表示法，會傳回 -1 (True)，否則會傳回 0 (False)。

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/LogicalFunctions/logical-functions.htm)[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/LogicalFunctions/logical-functions.htm)IsText( expr )

資訊備註如果運算式為 NULL，IsNum 和 IsText 都會傳回 0。

範例：

下列範例載入具有混合文字和數值的內嵌表格，並新增兩個欄位以檢查值是否分別為數值和文字值。

```
Load *, IsNum(Value), IsText(Value)
Inline [
Value
23
Green
Blue
12
33Red];
```

產生的表格如下所示：

Resulting table

| Value | IsNum(Value) | IsText(Value) |
| --- | --- | --- |
| 23 | -1 | 0 |
| Green | 0 | -1 |
| Blue | 0 | -1 |
| 12 | -1 | 0 |
| 33Red | 0 | -1 |