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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
sfloberg
Partner - Contributor III
Partner - Contributor III

Where clause

I want to exclude the projectnames with 'demo' as one whole word. The only thing I have to go on is the word 'demo' because the user can enter whatever they want into the field.

I have the following table:

Table1:

LOAD * INLINE [

Projectname

'Test1'

'Test demo'

'Test demo Test'

'demonstration'

'Test3'

'demo'

'Test democenter'

'Test demon'

];

How can I write a WHERE statement that only gives me the result:

'Test1'

'demonstration'

'Test3'

'Test democenter'

'Test demon'

9 Replies
dsharmaqv
Creator III
Creator III

tcullinane
Creator II
Creator II

Im sure there must be an easier way but you could;

Table1tmp:

LOAD * Rowno() as Row;

LOAD * INLINE [

Projectname

'Test1'

'Test demo'

'Test demo Test'

'demonstration'

'Test3'

'demo'

'Test democenter'

'Test demon'

];

noconcatenate

ParsedTable:

Load *, subfield(Projectname,' ') as Subfield resident Table1tmp;

Load Row as ExcludedRow resident ParsedTable

Where match(Subfield,'demo');

Table1:

Load Projectname resident Table1tmp where not exists(ExcludedRow,Row);

Drop Table Table1tmp, ParsedTable;

rahulpawarb
Specialist III
Specialist III

Hello Stephanie,

Trust that you are doing well!

Please refer below given sample script:

Data:

LOAD * INLINE [

Projectname

'Test1'

'Test demo'

'Test demo Test'

'demonstration'

'Test3'

'demo'

'Test democenter'

'Test demon'

]

WHERE NOT wildmatch( Projectname, 'demo','demo *','* demo', '* demo *');

Hope this will be helpful.

Regards!

Rahul

mdmukramali
Specialist III
Specialist III

Hi,

you can use string function to get the result:

Table1:

LOAD * INLINE [

Projectname

Test1

Test demo

Test demo Test

demonstration

Test3

demo

Test democenter

Test demon

]

Where Index(Projectname,'demo ')<1 and Projectname<>'demo' and Right(Projectname,5)<>' demo' ;

Thanks,

Mukram

Anonymous
Not applicable

Try the below, double wildcards (*) used either side of the word demo;

Data: 

LOAD * INLINE [ 

Projectname 

'Test1' 

'Test demo' 

'Test demo Test' 

'demonstration' 

'Test3' 

'demo' 

'Test democenter' 

'Test demon' 

WHERE NOT wildmatch(Projectname, '*demo*')

MarcoWedel

Where not ' '&Projectname&' ' like '* demo *'

susovan
Partner - Specialist
Partner - Specialist

Hi,

You can also try this,

Table1:

LOAD * INLINE [

Projectname

'Test1'

'Test demo'

'Test demo Test'

'demonstration'

'Test3'

'demo'

'Test democenter'

'Test demon'

]

Where not WildMatch(Projectname,'Test demo','* Test','demo');

Warm Regards,
Susovan
Anonymous
Not applicable

Hi,


Try this below script, It will solve your problem.


Table1: 

LOAD * INLINE [ 

Projectname 

'Test1' 

'Test demo' 

'Test demo Test' 

'demonstration' 

'Test3' 

'demo' 

'Test democenter' 

'Test demon' 

WHERE NOT wildmatch( Projectname, 'demo','demo *','* demo', '* demo *');



Thanks & Warm regards,

Venkata Sreekanth

sasiparupudi1
Master III
Master III

Try

Temp:

Load

    Projectname,

    if (Lower(Projectname)='demo',1,

     If( Index(Lower(Projectname & ' '),' demo ')>0,1,0)) as Flag;

LOAD * INLINE [

Projectname

'Test1'

'Test demo'

'Test demo Test'

'demonstration'

'Test3'

'demo'

'Test democenter'

'Test demon'

];

Temp1:

NoConcatenate Load

Projectname,

if (Lower(Projectname)='demo',1,

     If( Index(Lower(Projectname & ' '),' demo ')>0,1,0)) as Flag

Resident Temp

where Flag=0;

Drop Table Temp;

HtH

Sas