Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
gsbeaton
Luminary Alumni
Luminary Alumni

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
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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
Luminary Alumni
Luminary Alumni
Author

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