Pick() Function in QlikView

This article describes how the Pick() function works in QlikView applications.

Introduction

The Pick() function is a QlikView script function. The Pick() function works just the same as the INDEX() function of Excel. The Pick() function can be used with a script and user interface. This function returns the nth expression and also string in the list.

The INDEX() returns a value or the value reference from a table. It returns the value in one of the following two forms:

  • Array form
  • Reference form

Array form: In this form it returns a value of a specified array of cells.

Reference form
: In this form it returns the reference of the specified cells.

Syntax of Pick() function

dual Pick (position{, Expression})

In this syntax the first parameter checks the position of the expression and returns the appropriate expression or string depending on position.

Why use Pick() function?

There are the following possible uses of the Pick() function:

  • Pick() function avoids the use of Nested IF statements.
  • It can be used to dynamically set the analysis expression.
  • The combination of Pick() and Match() functions can be used in switch case statements.

The dynamic set analysis expression adds the aggregate function like sum, Avg, Max, Min, Count and so on.

Step 1: Open the QlikView application

In the first step you need to open the QlikView application then go to File-> New, then this window will be opened.

After clicking New option

Step 2: Select text object

Now the next step is to select the text object. In the menu bar there is the option Layout. Select:
Layout->New sheet object-> Text object.

text

Step 3:
New text object

Now in this window we define an expression and click on the Ok button.

exp

Now you will see it returns the value of the expression in the first position.

Step 4: Change position

If we want to change the position of an expression then go to the properties of the text object by simply right-clicking on the text object. If we change the position then it gives another value depending on the position.

property

Suppose in this example I change the position to 2 from 1.

position

Now you can see the value has changed. Now the Pick() function returns the value whose position is 2.

main1

Step 5: Save file

The next step is to save our QlikView file.

save file

Step 6: Change the color of the text object

If you want to change the color of the text object then go to the properties of the text object by simply right-clicking on the text object.

pro

Now this window will be opened and select the caption tab. Then this window will be opened.

The color of the text object exists in two ways.

  • Active caption
  • Inactive caption

Active caption: It shows the color of a text object only in active mode.

Inactive caption: It shows the color of the text object only inactive mode.

Here we set the color for the active caption. Then click on the background color in the active caption.

back

Step 7:Then it shows color area

Now this window will be opened and it shows the color area. Then click on the fixed button.

fix

Step 8: If we click on the fixed button then it shows a different color. Select the color and click on the Ok button.

ok

Then you will see the color of the text object in active mode. When we select the text object then the color will be shown.

active mode

If we do not select a text object then no color will be shown.

no color

Now follow this process to also apply the color for an inactive caption of the text object.

Summary

The main purpose of this article is to introduce the functionality of the Pick() function and also describe how the pick function works in QlikView.