Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

gsbeaton
Contributor II

Conditional Load or Where

Hi Folks,

Is it possible to conditionally specify a WHERE statement in QlikView - the following code snippet won't work, but it gives you an idea of what I want to do:

LOAD * FROM  STDQVD\TRANSACTIONS.qvd (qvd)

if([Allow Sensitive Transactions]='Y'

     ,WHERE NOT EXISTS([Transaction Detail Code],1212,1234,1909)

);

Any ideas gratefully received.

Many thanks

George

1 Solution

Accepted Solutions
MVP & Luminary
MVP & Luminary

Re: Conditional Load or Where

Yes, possible. Here's one way. "Allow Sensitive Transactions" must be a variable -- perhaps loaded from another table. It can't be part of the transactions.qvd you are loading.

Not syntax checked, but will give you the idea.

LET vCondition = if(vAllowSensitiveTransactions = 'Y',

,' '  // Allow all trans

, 'WHERE NOT match([Transaction Detail Code], 1212, 1234, 1909)'

);

LOAD * FROM  STDQVD\TRANSACTIONS.qvd (qvd)

$(vCondition);

-Rob

http://robwunderlich.com

2 Replies
MVP & Luminary
MVP & Luminary

Re: Conditional Load or Where

Yes, possible. Here's one way. "Allow Sensitive Transactions" must be a variable -- perhaps loaded from another table. It can't be part of the transactions.qvd you are loading.

Not syntax checked, but will give you the idea.

LET vCondition = if(vAllowSensitiveTransactions = 'Y',

,' '  // Allow all trans

, 'WHERE NOT match([Transaction Detail Code], 1212, 1234, 1909)'

);

LOAD * FROM  STDQVD\TRANSACTIONS.qvd (qvd)

$(vCondition);

-Rob

http://robwunderlich.com

gsbeaton
Contributor II

Re: Conditional Load or Where

Thank you Rob.  That's just the steer I needed to get this one cracked!