Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Now accepting applications for the Qlik Luminary and Partner Ambassador Programs: Apply by July 6!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sureshbabukapu
Contributor II
Contributor II

Qlikview

Hai all, 

Iam new to qlik

Can any one please explain about Substringcount function briefly, and how we can give the expression and how it will return the values please explain. 

Thanks, 

Suresh

3 Replies
Sebastian_Linser
Support
Support

Hello @Sureshbabukapu 

https://help.qlik.com/en-US/sense/November2021/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunc...

Example Result
SubStringCount ( 'abcdefgcdxyz', 'cd' ) Returns '2'
SubStringCount ( 'abcdefgcdxyz', 'dc' ) Returns '0'

 

Hope that helps.

 

Best regards

Sebastian

 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂
nevopotokcloudinary
Creator
Creator

Hi,
You use SubStringCount to find if string contain a specific value and then you can detect the position of the text inside the string using Index function and use Mid to extract the string, the only issue is the you don't know the length of the extracted string but you can find the next space
nevopotokcloudinary
Creator
Creator

You can also use this expression to extract the substring (until the next space)

Given String = 'Qlik Sense 2021'

Substring = 'Sen'

Output = 'Sense'

=if(
	SubStringCount(String,'Sen')>0, //check if substring exist
     mid(String,
     Index(String,'Sen'), //string position of the string
     Index(Mid(String,Index(String,'Sen'),Len(String)-Index(String,'Sen')+1),' ') //number of chars that need to be extract (until the next space)
     )    ,'Substring not found')