Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Storing values in a variable

Hi please could someone help me with the following question.

I have an excel file that I am loading account numbers into qlikview

The account numbers are 10 digit long numbers and the count of the numbers can change through a user updating the excel file. I would like to store the numbers as follows in a variable . '1234657890', '1234567890', '1234567891' to use later in a where clause for a sql query.

My where clause would be like this.

Where acc No in ($myvariable)

Would this be possible and if so please could someone help me?

Thank you in advance

1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

LOAD Concat(@1, ', ') as Main_Account_Id_list
FROM

(
biff, no labels, table is Sheet1$);

let vlist = Peek('Main_Account_Id_list', 0);

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

6 Replies
Anonymous
Not applicable
Author

Set vVariable = '1234657890', '1234567890', '1234567891';

in the load statement use

where Match(accNo ,'$(vVariable)');

If you want to save the values dynamically into the variable, you can go with "Let" instead of 'Set'

Not applicable
Author

Thank you for the reply Shiva

Appologies i should have ben clearer in my question

the values that i want to get stored in a variable are loaded in as follows

LOAD @1 as "Main Account Id"
FROM

(
biff, no labels, table is Sheet1$);

there can be any amount of account id's stored in this excel file. I need the values that are loaded in as "Main Account id"  stored in a variable.

thanks in advance

Anil_Babu_Samineni

Would you share excel file

For me, this is working

SET Var = '1','2','3';

LOAD * Inline [

Field1 , Field2

Sample, 1

Sample, 2

Sample, 3

Sample,4

] Where WildMatch(Field2, $(Var));

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

LOAD Concat(@1, ', ') as Main_Account_Id_list
FROM

(
biff, no labels, table is Sheet1$);

let vlist = Peek('Main_Account_Id_list', 0);

Help users find answers! Don't forget to mark a solution that worked for you!
Not applicable
Author

Thanks Guys, All your answers were very helpful

Anil_Babu_Samineni

If you want to save the values dynamically into the variable, you can go with "Let" instead of 'Set'

LET Won't consider the static text. you may forget. Read this QlikView Addict: SET vs. LET

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful