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

Optimize AGGR() function inside a trigger

I've got a few variable input boxes that allows the user to filter patients in a healthcare application.

One filter is for # of admissions.  The field Admission_Flag is either 1 or 0, and the variable v_Admissions is the number of admissions entered into the input box.  When a value is entered, this expression is executed and MRN numbers are selected.  This runs slow and I would like to improve the performance.  Any ideas?

='(' & Concat({<[Patient MRN]=,PayorName=,[Payor GL]=,[Payor Level 1]=,[Payor Level 2]=,[Payor Level 3]=>}if(aggr(sum({<[Patient MRN]=,PayorName=,[Payor GL]=,[Payor Level 1]=,[Payor Level 2]=,[Payor Level 3]=>}

Admission_Flag),[Patient MRN])>= v_Admissions, [Patient MRN]), '|') & ')'

Thanks!

12 Replies
whiteline
Master II
Master II

Try this:


='(' & Concat({<[Patient MRN]={'=sum({<[Patient MRN]=,PayorName=,[Payor GL]=,[Payor Level 1]=,[Payor Level 2]=,[Payor Level 3]=>}Admission_Flag)>=$(v_Admissions)'},PayorName=,[Payor GL]=,[Payor Level 1]=,[Payor Level 2]=,[Payor Level 3]=>} [Patient MRN]), '|') & ')'

phcaptjim
Creator
Creator
Author

Whiteline, thanks for the reponse.  I'm not sure why, but I am unable to get your expression to make any selections on [Patient MRN].

whiteline
Master II
Master II

It's not clear what you're trying to achieve.

I thought it's the point since you reset the selections in your original expression.

Remove the [Patient MRN]=, under the sum() set analysis.

phcaptjim
Creator
Creator
Author

If the user enters admissions >= 2, then decided to change that to >=1, the selections have to be reset, so in the expression I am saying [Patient MRN]= so the current selection does not affect the selection that is being made.  This is a bit complicated and I'm probably not explaining it as best as I can.  Hopefully this helps.

whiteline
Master II
Master II

Could you upload brief sample ?

phcaptjim
Creator
Creator
Author

I've attached a very simple example.  Please let me know what questions you might have.

This works really quick on a small data set. 

perumal_41
Partner - Specialist II
Partner - Specialist II

Hi

Please use below expression in test Application

 

='(' &

Concat({<PAT_MRN=,PAT_MRN={"=sum({<[PAT_MRN]=>}ADMIT_FLAG))>= v_Admissions"}>} [PAT_MRN], '|') & ')'

Regards,

Perumal A

phcaptjim
Creator
Creator
Author

Thanks for the response Perumal.

When I apply that expression to the variable trigger (both on input and change) there are no selections made to PAT_MRN.  The ADMIT_FLAG has to be summed by MRN to select those who are greater than or equal to the input field (v_Admissions).

perumal_41
Partner - Specialist II
Partner - Specialist II


Hi

For me wroking .PFA sample application.