Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
eleni_theodorid
Partner - Creator
Partner - Creator

Performance question

Hi,

I have to create a whole app that is going to calculate something when a field selection is A and something else when the field selection is B.

Which is better solution from performance scope?

1. Create one expression to every single object that use this logic if(GetSelectedCount(FieldA])>0 , sum(FieldB),  sum(FieldC))

2. Or else create two separate expressions with condition on expession?

Keep in mind that I have to do that on every single object in the app and there are really a lot of objects (which are using conditional show on object).

Pleased for your advise,

Helen

6 Replies
Not applicable

How about doing this condition in the script.

eleni_theodorid
Partner - Creator
Partner - Creator
Author

It has to be working dynamically and be responsive to the selections...

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Conditional expression would perform best, but as you hinted, may be difficult to maintain with a lot of objects.

Using a variable to select the expression will give you both performance and maintainability. Define a variable "mycalc" as follows:

=if(GetSelectedCount(FieldA])>0 , 'sum(FieldB)',  'sum(FieldC)')


Note the equal sign and he quotes around the expressions.


Then code the chart expression as:

$(mycalc)


-Rob

http://masterssummit.com

http://qlikviewcookbook.com

petter
Partner - Champion III
Partner - Champion III

A dynamic expression directly via a table and a link to the selection field:

2015-09-24 #1.PNG

eleni_theodorid
Partner - Creator
Partner - Creator
Author

Thank you all guys,

I will testyour suggestions out and I will let you know.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Note that Petter's solution has one additional advantage that others may not have: you can make your Expression list configurable using an external file (e.g. an Excel file)

BTW Thanks Petter, the INLINE delimiter trick is something new I learned from your script.