Making life easier and business more efficient and profitable is what the advancement of technology is all about. One of the ways in which Qlik® specialists have made great strides in this is through the implementation of Qlik® pick and match functions that save you from needing to work with long, messy if-statements.
Avoid messy, long if-statements
In the past, if you wanted to create conditions for finding specific bits of information you would have needed to make use of an if-statement. If-statements worked by creating conditions, coded to look for something, and if it is there to deliver a result. Should the desired parameter not be found, the if-statement would then move to another give you the set alternative result, or it would keep looking. The latter option, where the search continues through a range of ongoing, different if-statements is what we call a nested if-statement, and these can become quite long and messy to deal with.
Get to the point with the Qlik® match function
The elegant solution that the Qlik® specialists arrived at is what we now know as the Qlik pick and match functions. Instead of coding out if-statement after if-statement, like picking through bits of straw to find the proverbial needle in the haystack, Qlik®’s match function will pick out and display only the matching information. That’s a lot simpler than slogging through the entire list of possibilities one by one.
A more in-depth explanation, for interested parties
Qlik®’s pick and match functions work together to find the necessary information by finding and returning specific integers and expressions. Here is an example of the code involved:
Pick(1 + match([type], ‘Small’, ‘Medium’, ‘Large’), [Custom Size], [Small Size], [Medium Size], [Large Size])
In this example we are searching through records for shirt sizes, let’s say. The pick function here will return an expression from the ‘Small’, ‘Medium’ or ‘Large’ list depending on the number returned between 1 and 4. Qlik®’s match function then returns another integer depending on the matching value in the list, from 0 if nothing is found to 3 if the last one is found.
So, when the match is returned a 1 is added, as seen in the code, to give the ‘pick’ value, which is the end result. If no match was found it will translate into a 1, which will display as “Custom Size”, and the rest from “Small Size” to “Large Size” will be displayed in numerical succession up from there.