This article will cover the syntax of the ‘NullAsNull’ regular script statement.
This statement stops the conversion of NULL values as previously specified using the NullAsValue statement.
Statement syntax
NullAsNull fieldlist;
Fieldlist | A comma separated list of fields where NULL values are to show as NULL values instead of a previously specified value. |
Example
In this example, all app NULL values are set to be changed to ‘Unknown’. Customers’ data containing many NULL values in the date of birth field is imported. To demonstrate switching off the conversion, a copy of the same data is loaded after the NullAsNull statement.
NullAsValue *;
Set NullValue = 'Unknown';
CUSTOMERS:
LOAD
id,
firstName,
lastName,
email,
dob
FROM [lib://Public:DataFiles/customers.xlsx]
(ooxml, embedded labels, table is Sheet1);
NullAsNULL *;
CUSTOMERS_COPY:
LOAD
id,
dob as dob2
FROM [lib://Public:DataFiles/customers.xlsx]
(ooxml, embedded labels, table is Sheet1);
Result
The ‘CUSTOMERS’ table is loaded into the app. All previous NULL values in the field ‘dob’ are set to ‘Unknown’. Copy of the data is loaded in the table ‘CUSTOMERS_COPY’. The NULL values in the field ‘dob’ are still showing as NULL.