Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator 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
Master II
Master II

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
Champion
Champion

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
Creator III
Creator III
Author

Thanks for your reply.

Can you please tell me how to do..

prieper
Master II
Master II

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 ...

manoj217
Creator III
Creator III

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
Champion
Champion

Guys already shows you examples below

bharatkishore
Creator III
Creator III
Author

Thank you so much...

nsetty
Partner - Creator II
Partner - Creator II

Using joins

RequiredEntries:

Load * INLINE

[

Required

'722006'

'722008'

'722010'

'722005'

'722011'

'722012'

'722013'

'722023'

'722025'

'722026'

];

.......

Where EXISTS (SystemCode, Required)

prieper
Master II
Master II

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