Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I quite new to Qlikview and need some advice on this issue.
In my Qlikview application, I have to get input from the user. The user needs to enter a part search string e.g 'A1002%' or 'B1001%' and based on the input, the rows will be displayed.
What is the best way to do that? I tried two ways and nothing seems to work.
1) Within the script, I defined a variable v1
****************************
SET v1 = 'A1002%';
tableA
LOAD PNo,
PName, ptype;
SQL SELECT PNo,
PName, ptype
FROM Parts where pName LIKE '$(v1)';
*******************************
I created an input box for variable v1 which allows user to enter the search string but it does not work. Still shows me the parts starting with A1002. I tried reloading but doesn't update.
2) If I don't use the variable v1 in the sql select statement, is there any other way? I tried this second method and loaded all rows from the table Parts. (This table is huge).
**********************
SET v1 = 'A1002%';
tableB:
LOAD PNo,
PName, ptype;
SQL SELECT PNo,
PName, ptype
FROM Parts where pName;
************************
Then I created a chart (straight table). In expressions, entered this
if (PName like v1, Pno)
But not getting the desired results. Please help.
hi
1. if you want to filter your data in the script level only then you can use this
load Pno,PName,Ptype from Parts where PName like 'A1002*';
but this will load only those rows which meets the above condition
2. if you want to load all the rows and want to display only those rows which meets the conditon of the input box
a. load * from Parts;
b. create a variable V1 ( go to settings----->variable overview), now create a input box with reference to V1
and create a straight table with condition if(PName like V1, Pno)
this will show only the filtered data in the straight table
regards
Peter
Hi Peter,
Thanks for the guidance. Now I realize that wildcard character in Qlikview is not "%" but it is *.
I tried the second method and it works now.