Column Expression regex error?

Hi

I am trying to strip non alpha-numeric characters from an Invoice Number field. I am using the column expressions node with the following expression:

upperCase(strip(regexReplace(column(variable(“var_invoiceNum”)) , “[^a-zA-Z0-9]” , “”)))

However, I get the following error message:

Execute failed: Cannot invoke “java.lang.CharSequence.length()” because “this.text” is null

a) what does this error message mean
b) where am I going wrong?

Thanks
Chris

Hi @fostc80857

This means you have null values in the column that you are applying this to. Try to put into a clause that checks this first.

if (column(variable("var_invoiceNum")) != null) {
    upperCase(strip(regexReplace(column(variable("var_invoiceNum")) , "[^a-zA-Z0-9]" , "")))
} else {
    null
}
3 Likes

Thanks @ArjenEX

That has worked.

1 Like

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