Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

function to find strings in the middle of another large string

I need no find a function to find the strings "AA12" and "BB12" in the middle of a large string.

And count how many AA12 and BB12 where found in a list of strings

example:

ASDRF-FRRTT-AA12-DSDSFDF006-

ASEERF-FQSETT-AA12-DSDSFDF009-

ASMAT1-FRRTT-BB12-DSDSFGF0008-

thanks

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Create a field in the script that gets the value 1 if there's a match:

LOAD

    MyString,

    if(wildmatch(MyString, '*AA12*','*BB12*'),1,0) as Flag

FROM ...somewhere...;

Then you can use an expression sum(Flag) in a textbox or chart to count these cases

If you just want to count how often AA12 occurs in MyString you can use substringcount(MyString,'AA12')


talk is cheap, supply exceeds demand

View solution in original post

1 Reply
Gysbert_Wassenaar

Create a field in the script that gets the value 1 if there's a match:

LOAD

    MyString,

    if(wildmatch(MyString, '*AA12*','*BB12*'),1,0) as Flag

FROM ...somewhere...;

Then you can use an expression sum(Flag) in a textbox or chart to count these cases

If you just want to count how often AA12 occurs in MyString you can use substringcount(MyString,'AA12')


talk is cheap, supply exceeds demand