Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
jagannalla
Partner - Specialist III
Partner - Specialist III

How to apply condition for qvd file with multiple values for one field?

Hi,

I've a qvd file with filds 4 with data as shown below:

s1.PNG

- I had a list box with B field as shown below:

s1.PNG

- Based on selection i want to load qvd file. If user selects only one value we can store that value in one variable and we can use that variable in where condition of qvd file. If user selects multiple values also we can store in a single variable but, how can apply this variable in where condition of qvd file.

For Eg:

LOAD A,

     B,

     C,

     D

FROM

Table1.qvd

(qvd)

WHERE(B = 1);

- i need to apply like this for all fields.

- For your reference i'm attaching my qvw file also.

20 Replies
qliksus
Specialist II
Specialist II

Sure Buddy no problem

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Hi Buddy,

- The Following code is working fine.

Set vA1='NoReads';

Set vA2='GoodReads';

Set vA3='MissingReads';

Set vB=45,47;

Table1:

LOAD

     A,

    A1,

     B,

     C

where (A1='$(vA1)' or A1= '$(vA1)' or A1= '$(vA1)' ) and match(B,$(vB);

LOAD

     A,

     if(A='No Read','NoReads',if(Len(A)>0,'GoodReads','MissingReads'))as A1,

     B,

     C

FROM

Table1.qvd ;

Table1:

LOAD

     A,

    A1,

     B,

     C

where (A1='No Read' or A1= 'GoodReads' or A1= MissingReads);

LOAD

     A,

     if(A='No Read','NoReads',if(Len(A)>0,'GoodReads','MissingReads'))as A1,

     B,

     C

FROM

Table1.qvd ;

- But the thing is i had few more fields to put in the condition.

For eg:

where (A1='$(vA1)' or A1= '$(vA1)' or A1= '$(vA1)' ) and match(B,$(vB) and match(C,$(vC) and..........;

- I'm getting the exact result when i use AND to concatenate the condition but if i use OR i'm not getting  the     exact result.

- If i give empty for one of the variable in above conditon it is not working.

For eg:

     Set vB=  ' ' ;

    Set vC=    '';

How can i overcome this buddy....

qliksus
Specialist II
Specialist II

Give something like

load * from table

where (A1='$(vA1)' or A1= '$(vA1)' or A1= '$(vA1)' ) or ( match(B,$(vB) ) or ( match(C,$(vC) )

qliksus
Specialist II
Specialist II

Hi,

As i am leaving office i cant reply today put ur problem i will reply once i am back

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

ok Qliksus...i'll wait for your solution in mean while i try myself...

qliksus
Specialist II
Specialist II

Did u get the solution

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

No...

qliksus
Specialist II
Specialist II

ok my question is

1) why did u want to use the OR condition

2) The OR and And will give different result bcoz generally OR will load all the data and AND will filter

some  data

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Actually i had two qvw files..

one with all selections i can make there.

For eg:

load A,B,C,D,E,F from table.qvd;

1. Now i'll take A,B,C in listbox respectively. So that i can choose my selection from this listbox.

2. To see how ouput comes here, i had taken one table box with all fields.

3. Now the data of table box will change based on selection made in listbox.

In second qvw file now  i had taken same table box with all fields but here i'm not taking any selections just i'm showing tablebox.

But i'm passing all selections made in first qvw while so dat i can write where conditon for qvd ...

In Where condtion if i user OR i'm not getting exact output when i compare with output of first qvw file. When I keep AND i'm getting exact result but, in where conditon if any field is compare with empty value i'm facing the problem.

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Qliksus,

Did you understood what i said...Is there any solution.