0

I am loding data in qlikview using statement

/ /Importing data from flat file
 dataimport:
 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],
 \\cagesre005\*GLDetl*
 (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

1 Answer 1

1

You can always use the Match function:

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

//Importing data from flat file
 dataimport:
    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]
     From 
        \\cagesre005\*GLDetl* (txt, codepage is 1252, no labels, delimiter is ';', msq)
    Where 
        Match( @10, $(vDocTypes) ) > 0
 ;  
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.