Discussion Board for collaboration on QlikView Scripting.
I'm looking to select a list of from a QVD and use the list of values in a SQL IN Clause.
For example if my data was the following:
LOAD * inline [
"ID|"First name"|"Last name"|Initials|"Has cellphone"
6|Peter|Franc|PF|Yes ] (delimiter is '|');
I would want a variable that would look like ID_LIST(1,2,3,4,5,6)
Then I would take that variable and use it in my SQL:
SELECT * FROM PEOPLE WHERE ID in($ID_LIST);
I've been trying to use getfieldselections to get the data from my ID and getting an unknown statement error.
Go to Solution.
Try something like this:
LOAD Concat(ID, ',') as ID_List inline [
LET vID_List = peek('ID_List',0,'MyTable');
SELECT * FROM PEOPLE WHERE ID in( $(vID_List) );
View solution in original post
You can create variable like below
SET Var = 1,2,3,4,5;
ID|First name|Last name|Initials|Has cellphone
6|Peter|Franc|PF|Yes ] (delimiter is '|') Where Match(ID, $(Var));
In you orient, You can try something like below
SELECT * FROM PEOPLE WHERE Match(ID, $(Var));
How would the table statement change if I was selecting from a QVD as opposed to building the table inline?
Replace inline [ .... ] with FROM qvdname.qvd (qvd)