Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
kev6brown
Partner - Creator
Partner - Creator

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
Specialist III
Specialist III

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

QFabian
kev6brown
Partner - Creator
Partner - Creator
Author

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

In that case, please check this :

QFabian_0-1613660608562.png

 

QFabian
marcus_sommer

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

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

- Marcus

kev6brown
Partner - Creator
Partner - Creator
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