Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
smilingjohn
Specialist
Specialist

Substringcount

Hi All,

Please correct me if  my understanding is wrong 

I have a script in the load script which is like 

if(SubStringCount(PTWGRP ,CAT)>0,CAT) as Sub_Category,

 Understanding:

Both the field (PTWGRP ,CAT) should be  greater than 0 , if PTWGRP  is null then it will display the entries of Cat 

and create a file called Sub_Category  

Is this is what this is doing ?

 

Thanks in Advance 

 

2 Replies
Or
MVP
MVP

SubStringCount returns the number of times the second string (CAT) appears in the first string (PTWGRP). For example, if the first string is 'aaabbc' and the second string is 'b' the result will be 2.

https://help.qlik.com/en-US/qlikview/May2021/Subsystems/Client/Content/QV_QlikView/Scripting/StringF...

If you're trying to check whether the length of the strings is >0 (so, in effect, if the strings are not null/blank), you should be using Len(Field), and if you're trying to return the first non-null value from those fields you should be using coalesce(Field1,Field2)

smilingjohn
Specialist
Specialist
Author

Hi Expertise any inputs on the post ?

 

Thanks