Qlik Community

QlikView Security & Governance

Discussion Board for collaboration on QlikView Security and Governance.

QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
New Contributor II

loop through array to load data in qlikview

I am loding data in qlikview using statement

/ /Importing data from flat file
LOAD  @1 AS CoCd,
@2 AS Period,
@3 AS [Doc. Date],
@4 AS [Pstng Date],
@5 AS TranslDate,
@6 AS Reference,
@7 AS DocumentNo,
@8 AS Crcy,
@9 AS Year,
@10 AS [Doc. Type],
txt, codepage is 1252, no labels, delimiter is ';', msq)

where @10 = 'KA' or @10 = 'KG' or @10 = 'KR' or @10 = 'KH' or @10 = 'KN' or @10 ='AB' or @10 ='IK' or @10 ='IM' or @10 ='MM' or @10 ='RE' or @10 ='RN';

this statement loads data perfectly but it is not dynamic since if I want to change the @10 to some different value I have to make change directly to the script, I am looking for a way that loop through a array containing these values and load data to the table

something like creating variable

$(vDocTypes) = 'KA','KG','KR','KH','KN','AB','IK','IM','MM','RE' ,'RN';

which I can use in where clause that goes through the values in the array and load the data

2 Replies

Re: loop through array to load data in qlikview

I'm not sure if the $-sign expansion worked within the script and maybe you will need some attempt to get the right syntax but try something like this:

set vDocTypes = "'KA','KG','KR','KH','KN','AB','IK','IM','MM','RE' ,'RN'";


where match(@10, $(=$(vDocTypes)));

- Marcus

New Contributor II

Re: loop through array to load data in qlikview

Thanks Marcus, I tried Match( @10, $(vDocTypes) ) and it worked

Community Browser