Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

bharatkishore
Contributor III

remove where condition hard coding

    Hi All,

I have a qvd and few fields. Now when i load that qvd instead of loading whole data i need to only few system codes.

For that i am writing hard coding in where condition as below:

Where

WildMatch(SystemCode,'722006',

'722008',

'722010',

'722005',

'722011',

'722012',

'722013',

'722023',

'722025',

'722026');

Can you please tell me is there any approach to remove this had coding.

Thanks,

Bharat

1 Solution

Accepted Solutions
prieper
Honored Contributor II

Re: remove where condition hard coding

hmm,

you may put your condition into a variable:

LET myFilter = '722006, 722008';

LOAD .... FROM ....

WHERE WILDMATCH(Systemcode, $(myFilter));

The above may work easy for numbers, strings must be enclosed in apostrophs:

LET myFilter = CHR(39) & '722006' & CHR(39) & ',' & CHR(39) & '722008' & .... etc.

LET myFilter = CHR(39) & '*' & CHR(39) would not filter anything ...

View solution in original post

8 Replies
YoussefBelloum
Esteemed Contributor

Re: remove where condition hard coding

Hi,

the script can't guess the references you want to remove, so you have to write it somewhere.

you can put it in a variable at the beginning of the script and call the variable on the WHERE, it will look cleaner maybe ?

bharatkishore
Contributor III

Re: remove where condition hard coding

Thanks for your reply.

Can you please tell me how to do..

prieper
Honored Contributor II

Re: remove where condition hard coding

hmm,

you may put your condition into a variable:

LET myFilter = '722006, 722008';

LOAD .... FROM ....

WHERE WILDMATCH(Systemcode, $(myFilter));

The above may work easy for numbers, strings must be enclosed in apostrophs:

LET myFilter = CHR(39) & '722006' & CHR(39) & ',' & CHR(39) & '722008' & .... etc.

LET myFilter = CHR(39) & '*' & CHR(39) would not filter anything ...

View solution in original post

manoj217
Contributor III

Re: remove where condition hard coding

he is mentioned like create a variable like

set records=

WildMatch(SystemCode,'722006',

'722008',

'722010',

'722005',

'722011',

'722012',

'722013',

'722023',

'722025',

'722026');

then call the variable like

where $(records)

it is similar to your syntax but just reduce the hardcode

YoussefBelloum
Esteemed Contributor

Re: remove where condition hard coding

Guys already shows you examples below

bharatkishore
Contributor III

Re: remove where condition hard coding

Thank you so much...

Partner
Partner

Re: remove where condition hard coding

Using joins

RequiredEntries:

Load * INLINE

[

Required

'722006'

'722008'

'722010'

'722005'

'722011'

'722012'

'722013'

'722023'

'722025'

'722026'

];

.......

Where EXISTS (SystemCode, Required)

prieper
Honored Contributor II

Re: remove where condition hard coding

JOIN is a really performant tool, however you may not change it to load all, as the OP has asked for.