$ISNULL (check NULL)
$ISNULL determines whether data acquired with the [CSV_COLUMN_NAME] tag is NULL or a 0-byte character.
Syntax
return-value=$ISNULL(column-name)
Values
-
return-value
Specifies the name of the variable into which the evaluated results are set. If the value of the column specified by column-name is NULL, 1 is returned; if it is a 0-byte character, 0 is returned.
-
column-name
Specifies the variable name of the column that is defined by the [CSV_COLUMN_NAME] tag.
Status
The following table lists and describes the possible statuses:
|
Status |
Description |
|---|---|
|
NORMAL |
Normal end |
|
NODATA |
— |
|
ERROR |
— |
|
Script execution interrupted |
An invalid argument was specified, or an error other than the above occurred. |
- Legend:
-
—: Not applicable
Example
The following example acquires data from the file input.csv; it then outputs COLUMN1 IS NULL if COLUMN1 is the NULL character, or outputs COLUMN1 LENGTH IS 0 if COLUMN1 is a 0-byte character:
[SET_VALUE]
FILENAME = 'input.csv'
CNT = 1
[CSV_FILE_LOOP]
FILENAME
[CSV_COLUMN_NAME]
COLUMN1 = 1
[BEGIN]
[SET_VALUE]
LEN = $LENGTH(COLUMN1)
[IF]
LEN = 0
[THEN]
[SET_VALUE]
VAL=$ISNULL(COLUMN1)
[IF]
VAL = 1
[THEN]
[SET_VALUE]
MSG = 'LINE('+CNT+') COLUMN1 IS NULL'
[ELSE]
[SET_VALUE]
MSG = 'LINE('+CNT+') COLUMN1 LENGTH IS 0'
[IF_END]
[ELSE]
[SET_VALUE]
MSG = 'LINE('+CNT+') COLUMN1 LENGTH IS '+LEN
[IF_END]
[SET_VALUE]
$ECHO(MSG)
CNT = $ADD(CNT,1)
[END]
[SET_VALUE]
$SETSTATUS('NORMAL')
[CSV_FILE_LOOP_END]Contents of input.csv
,bbb,ccc "",bbb,ccc aaa,bbb,ccc "aaa",bbb,ccc
- Execution result:
-
LINE(1) COLUMN1 IS NULL
LINE(2) COLUMN1 LENGTH IS 0
LINE(3) COLUMN1 LENGTH IS 3
LINE(4) COLUMN1 LENGTH IS 3