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

Announcements
Join us in Toronto Sept 9th 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.

1 Solution

Accepted Solutions
qliksus
Specialist II
Specialist II

What i understood is u want to achieve a IN condition by passing multiple values so use the match function for that

Load * from table.qvd

where match(b,$(var);

View solution in original post

20 Replies
Not applicable

Hi,

  I am not sure, why you want to trigger a refresh a file based on your selection.

Your approach should be to Load all the Data Source and Link them by adding a flag.

Tabl1:

Load B FROM Table1.qvd (qvd);

Tab2:

Load *,

1 AS B FROM Table2.qvd (qvd);

Tab3:

Load *,

34 AS B FROM Table3.qvd (qvd)

and so on.

Based on the selection you should be able to Hide/Display the Data.

Regards,

Amit

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Hi,

Actually the think is i had two qvw files. The user can make selections in one qvw file. I'm storing all this selections in different variables and i'm passing this variable to another qvw file.

For Eg:

In first qvw file i had qvd file like this.

Load A,B,C,P,Q,R,S from Table1.qvd;

- I' had taken in listbox like this:

Capture.PNG

- In button actions i written for variable(vSend) with value GetFieldSelections(F1,',',50) by using this button i'm navigating to another qvw file with this variable.

In second qvw file i had written like this

Load A,B,C,$(vSend)  from Table1.qvd;

- Now it loads all fields of particular qvd file. But, while loading the qvd file it should load based on selections done for B,C etc..as i said previously.

qliksus
Specialist II
Specialist II

What i understood is u want to achieve a IN condition by passing multiple values so use the match function for that

Load * from table.qvd

where match(b,$(var);

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Thanks a lot qliksus..

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Hi,

I need some help from you again..

- I'm storing all the selections of the following listbox in one variable like this:

Capture.PNG

- Now the variable vCdata holds the value vCdata=GoodReads,MissingReads,NoReads.

- But how to keep where condition based on this variable to qvd file.

- The field C contains the data like this.

     C

Capture.PNG

Main1:

LOAD A,

     B,

     C

     if(C='No Read','NoReads',if(Len(C)>0,'GoodReads','MissingReads'))as C1,

    

FROM

Table1

where match(B,$(var) and ..........;

qliksus
Specialist II
Specialist II

Sorrry for the late reply can u explain again i didnt understand wat u want

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

ok i'll explain you with detail.

- My qvd file contains the data like this:

Capture.PNG

- In first qvw file i written in the editscript like this:

Table1:

LOAD

     A,

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

     B,

     C

FROM

Table1.qvd;


DisplayData:

LOAD * INLINE [

    F1

    NoReads

    GoodReads

    MissingReads

];

- Now i had take F1 in listbox and i'm passing all selections of this listbox in variable to another qvw file(i.,e vSend=GoodReads,MissingReads,NoReads)

Capture.PNG

- In second qvw file i'm loading the qvd file as you said previously. It is working for the field B. B'coz B fields holds the data of passed variable so condition is working properly with Match condtion.

- But now A fields doesn't hods the data of variable vSend.

- I want to apply conditon for A field in second qvw like this

Table1:

LOAD

     A,

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

     B,

     C

FROM

Table1.qvd where A1='No Read' or A1= 'GoodReads' or A1= MissingReads;

- But i dont want to give like above i want to give like Match(A1,$(vSend))


qliksus
Specialist II
Specialist II

Try like this then

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 ;

jagannalla
Partner - Specialist III
Partner - Specialist III
Author

Ya it's working qliksus. Once again thanks a lot if i face any problem in this area i'll approach you.