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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
kev6brown
Partner - Creator II
Partner - Creator II

List Box

Hi,

 

I have a list box, Drugs, but I only wanted to see the values that are being populated against patient_no. So rather than see every drug that has no associated patient i only want to see the drugs that have associated patients, how do i do that?

 

Kev

1 Solution

Accepted Solutions
marcus_sommer

Try it with:

subfield(aggr(only({< Patient = {"*"}>} Drug), Drug), ,'!',1)

- Marcus

View solution in original post

6 Replies
QFabian
MVP
MVP

Hi @kev6brown , if you want to do that in script, you can do something like this, the key is find a field present in both tables, in this case a use ID_Drug, but it can be patient_no if it is present in both tables.

EXISTS is a great function to filter as you want

Patient:

Load

patient_no,

Id_Drug,

more fields...

From yoursource;

 

Drug:

Load

Id_Drug,

Drug

From yoursource

Where

exists (Id_Drug, Id_Drug);

 

Please let my know if this is an acceptble solution for you

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
kev6brown
Partner - Creator II
Partner - Creator II
Author

I can't access the script to do this, can it be done from the front end?
QFabian
MVP
MVP

In that case, please check this :

QFabian_0-1613660608562.png

 

Greetings!! Fabián Quezada (QFabian)
did it work for you? give like and mark the solution as accepted.
marcus_sommer

You could try it with an expression as listbox-source - something like this:

aggr(only({< Patient = {"*"}>} Drug), Drug)

- Marcus

kev6brown
Partner - Creator II
Partner - Creator II
Author

That's perfect, thank you so much. Just to throw a curveball in, I have the following too -

=subfield([Drug],'!',1)

How do I make the expression include this?

marcus_sommer

Try it with:

subfield(aggr(only({< Patient = {"*"}>} Drug), Drug), ,'!',1)

- Marcus