Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

qvraj123
Contributor II

Where IN () - Load the values from .txt file

Hi All,

What is the best way to handle this - I have an SQL server query like Where ChangeName IN ('A','B','C') - I have around 9500 to 10,000 values hard coded - I want to move these to an .txt file and use the values from the text file

tried something like this based on some other post

WHERE ChangeName IN ($Include='path to the text file')  - This is not working - it is throwing an error

what could be the best approach considering the IN values may be around 10 to 15,000

Thanks a lot

4 Replies
neelamsaroha157
Valued Contributor II

Re: Where IN () - Load the values from .txt file

Try this -

Load distinct ChangeName

from YourTextFile;


YourMainTable:

Load * from YourtableName  where Exists(ChangeName);


vkish16161
Contributor III

Re: Where IN () - Load the values from .txt file

try below:

You can create a Mapping table.

M_Where_Clause:

Mapping load     Where_Field , 1 as ID

From Your_Where Clause_file.xls

Fact_table:

load *

From Data.qvd

where  Applymap('M_Where_Clause', Where_Field ,0) = 1;

//**The Where_Field should be made available in the Fact_table.

Highlighted
Partner
Partner

Re: Where IN () - Load the values from .txt file

I think best way would be the wild match qualifier as below

Load * from abc.txt Where wildmatch(ChangeName, '*A*','*B*','*C*')

i believe effective than IN function.

qvraj123
Contributor II

Re: Where IN () - Load the values from .txt file

Thank you Neelam, Vishnu -  I was trying to get this done at the SQL Select level - These are good alternate approaches - thanks for your time - actually the below is working in SQL Select

SQL SELECT

--

--

WHERE ChangeNumber In ( $(Must_Include=full_path) ) ;

this worked without any error