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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
suzel404
Creator
Creator

How can I get the values that contains 4 or 5 or 6 and 7or 8 or 9 ?

Hi all,

I have a sample data  and I want to flag to 1 all values that contains 4 or 5 or 6 and 7 or 8 or 9.

...4..7 or ...4..8 or ...4..9

...5..7 or ...5..8 or ...5..9

...6..7 or ...6..8 or ...6..9

Thank for your help.


1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

LOAD

  *,

  If(WildMatch(DATA, '*4*7','*4*8', '*4*9', '*5*7', '*5*8', '*5*9', '*6*7', '*6*8', '*6*9'), 1, 0) AS FLAG_1,

  If(WildMatch(DATA, '1*6','1*7','1*8','1*9','2*6','2*7','2*8','2*9') AND NOT WildMatch(DATA, '*4*', '*5*'), 1, 0) AS FLAG_2;

LOAD

*

FROM DataSource;

Regards,

Jagan.

View solution in original post

11 Replies
its_anandrjs
Champion III
Champion III

Hi,

You can add this flag in the load script

LOAD
*, if(findoneof(DATA,456789) > 0,1,0) as FlagTest;

Load * Inline


Regards

Anand

suzel404
Creator
Creator
Author

Hi Anand,

Thank you for your reply. I use the findoneof function but how can I get values

that contains 1..6 or 1..7 or 1..8 or 1..9 or 2..6 or 2..7 or 2..8 or 2..9

if(findoneof(DATA,126789) > 0,1,0) as FlagTest don't give me the good result.

MarcoWedel

can you please post sample data together with expected result to clarify your requirements

nagaiank
Specialist III
Specialist III

Try the following expression

If(Match(Data,'4','5','6') > 0 and Match(Data,'7','8','9') > 0,1,0) as Flag

suzel404
Creator
Creator
Author

Hi Marco,

I want to create 2 FLAG:

- FLAG_1 : all values that contains the string : ....4..7 or ....4..8 or ....4..9 or ....5..7 or ....5..8 or ....5..9 or ....6..7 or ....6..8 or ....6..9

- FLAG_2 : all values that contains the string : 1..6 or 1..7 or 1..8 or 1..9 or 2..6 or 2..7 or 2..8 or 2..9 without 4 and 5 in the string.

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

LOAD

  *,

  If(WildMatch(DATA, '*4*7','*4*8', '*4*9', '*5*7', '*5*8', '*5*9', '*6*7', '*6*8', '*6*9'), 1, 0) AS FLAG_1,

  If(WildMatch(DATA, '1*6','1*7','1*8','1*9','2*6','2*7','2*8','2*9') AND NOT WildMatch(DATA, '*4*', '*5*'), 1, 0) AS FLAG_2;

LOAD

*

FROM DataSource;

Regards,

Jagan.

SunilChauhan
Champion II
Champion II

if( match(Fieldname ,4 , 5 , 6 )  and match(Fieldname ,7 , 8 , 9),1,0) as Flag

or

if( (Fieldname=4 or Fieldname=5 or Fieldname=6 )  and  (Fieldname=7 or Fieldname=8 or Fieldname=9 ) ,1,0)

hope thia helps

Sunil Chauhan
alkesh_sharma
Creator III
Creator III

Try This

if(findoneof(DATA,456) > 0 AND findoneof(DATA,789)>0,1,0 ) as FLAG;

suzel404
Creator
Creator
Author

Hi Nagaiank,

Thank for your response but all values are selected. I have a flag with 0 and not 1.

The value 12 is selected but not contains 4,5,6 and 7,8,9