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

Alternate method for Pick Match

Hi All,

We are trying to optimize the expression, we are having 43 rows in a straight table each row has its own expression.

Please refer Table2(Straight table) in the attached QVW, Column1 is Inline Table field, Column2 is the Expression.(have taken only 2 rows in this example).

As of now we are using Pick(Match()).

Can anyone suggest any better option?

 

Thanks

4 Replies
dplr-rn
Partner - Master III
Partner - Master III

Pickmatch is the most efficient way of doing this IMO (compared to if statements)

check

http://dailyqv.blogspot.com/2013/01/using-pick-and-match-functions-for.html

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You will encounter performance problems because both count expressions will be calculated in all cases.  The Pick(Match()) will only select one of the results. 

A better way to do this is move the Pick(Match()) into a variable (or double DSE) that returns the string value of the selected expression and then calculate it. See https://qlikviewcookbook.com/2014/12/how-not-to-choose-an-expression/

-Rob

MikeW
Creator
Creator

Rob, I think because the $(=...) is evaluated ignoring dimensions in the table, it would not work in this case since the 'Field' is actually a dimension. It would be awesome if there was a way around that...

I think if the expressions are nicely cacheable, then calculating all cases and then picking one may be ok. They will all need to be calculated on the other rows anyways. 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Good point. If I can think if a syntax that would work, I'll post back. 

-Rob