Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
stuwannop
Contributor II

Create a Flag Based on a Text String

Hi Everyone

Wondering if you could help with this. I have a field in a data table that may or may not contain the string "SORD". This could be anywhere in the text string.

What I'd like to be able to do is create a flag (1 or 0) as a new field depending on whether the text string SORD exists in the field. I can do it in Excel but can't get it working in Qlik!

Thanks in advance

Stu

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Create a Flag Based on a Text String


Hi,

Try WildMatch() or substringcount().  Check help file for examples.

LOAD

*,

If(substringcount(Dimension, 'SORD')>0, 1, 0) as Flag

FROM DataSource;

OR

LOAD

*,

If(WildMatch(Dimension, '*SORD*')>0, 1, 0) as Flag

FROM DataSource;

Regadrs,

Jagan.

3 Replies
MVP
MVP

Re: Create a Flag Based on a Text String


Hi,

Try WildMatch() or substringcount().  Check help file for examples.

LOAD

*,

If(substringcount(Dimension, 'SORD')>0, 1, 0) as Flag

FROM DataSource;

OR

LOAD

*,

If(WildMatch(Dimension, '*SORD*')>0, 1, 0) as Flag

FROM DataSource;

Regadrs,

Jagan.

MVP
MVP

Re: Create a Flag Based on a Text String

Try like:

If(SubStringCount(YourField, 'SORD')>0, 1, 0) as Flag

stuwannop
Contributor II

Re: Create a Flag Based on a Text String

Marvellous - thanks to both of you that works a treat!

Have a good day.

Stu

Community Browser