Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
smilingjohn
Specialist
Specialist

Script Logic

Hi All, 

Can any one please help me in understanding this logic ......

Sub_Prod:
LOAD ID,
if(SubStringCount(Product ,Sub_Product)>0,Sub_Product) as Sub_Prod
Resident Temp
where SubStringCount(Product ,Sub_Product)>0;

Thanks in Advance

 

Labels (1)
1 Reply
vinieme12
Champion III
Champion III

The if() is redundant since the data is already filtered for the same criteria

SubStringCount(Product ,Sub_Product)   This returns the number of occurences Sub_Product exists in Products

 

from qlik help

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

 

You can just do

 

Sub_Prod:
LOAD ID,
Sub_Product 
Resident Temp
where SubStringCount(Product ,Sub_Product)>0;   << because data is already filtered for same condition

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.