Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

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

Tags (2)
1 Solution

Accepted Solutions

Re: function to find strings in the middle of another large string

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
1 Reply

Re: function to find strings in the middle of another large string

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
Community Browser