Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
NarenS701
Contributor
Contributor

StringHandling.LEN(col1) return -1 when value of col1 is null

Hi All,

Can someone explain why StringHandling.LEN returns -1 in below scenario?

StringHandling.LEN(col1) return -1 when value of col1 is null.

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi

You can look into the source code of this function in Repository-->Code-->Routine-->System-->StringHandling.

  public static int LEN(String string) {

    return string == null ? -1 : string.length();

  }

 

To avoid the value is -1 if it is null, you can set it to 0 with this expression on tMap.

row1.columnName==null?0:StringHandling.LEN(row1.column)

 

Regards

Shong

View solution in original post

2 Replies
Anonymous
Not applicable

Hi

You can look into the source code of this function in Repository-->Code-->Routine-->System-->StringHandling.

  public static int LEN(String string) {

    return string == null ? -1 : string.length();

  }

 

To avoid the value is -1 if it is null, you can set it to 0 with this expression on tMap.

row1.columnName==null?0:StringHandling.LEN(row1.column)

 

Regards

Shong

NarenS701
Contributor
Contributor
Author

Thank you @Shicong Hong​