Convert to Null

Hi everyone. I have a question. I have an attribute called occupation. There are some values in it which are ____. It says to convert ____ to Null. It is stated to note that Null is different from empty string. Could someone please suggest me how to do so?

@Ammar_74 you could use the

Like this:

Convert Strings to Missing Values

toNull(replace($$CURRENTCOLUMN$$, “N.A.”, “”)) searches for “N.A.” in all selected columns, replaces them with “” and returns a missing value, if the resulting string is empty ( toNull converts empty strings to a missing value). For multiple strings to replace, a regular expression separating the target strings with |can be used: regexReplace($$CURRENTCOLUMN$$, “N.A.|-”, “”) . This replaces both occurrences of “N.A.” and “-” with empty strings.


Hey @Ammar_74

you could again use the Rule Engine Node with something along the lines of NOT $column1$ = "yourString" => $column1$ this lets stay the non matching Strings as is and the matching ones are replaced by null/missing value.


Hello @Ammar_74
A useful one is with the ‘Rule Engine’ node; uncomplete definition of rules leads to missing values…

By typical way of coding, you give a code line for no specific rules like…

$occupation$ LIKE "___" => ""
TRUE => $occupation$

this will return empty values but not missed as your requirement.

But if you code in this way, it will return the nulls (missing) that you look for:

NOT $occupation$ LIKE "___" => $occupation$

this code example will return nulls for your use case, I haven’t tested it but I think that it will work.



This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.