Using Actions to Select Field Values



Occasionally an issue will come up in an application where you’ll want to use an action to automate making field selections. This makes it easier for a user to select a group of field values with a single click. There are a few different ways to do this, and the syntax is slightly different than what a  developer might expect.

First, you’ll need to use a button, text object, or other object with an action to Select in Field. The syntax for a single field value is just the value you are looking to select. So if you wanted to select A from Dim1, you would say:

Select in Field Dim1: A

The resulting selection would be A from Dim1.

If you wanted to search for values that began with A in Dim1, you could say something like:

Select Dim1: A*

Now, say you wanted to select 2 values that didn’t have anything in common, like A and B. the syntax is to put your group of desired values in a pipe-delimited list inside parentheses. To select A and B, it would look like this: (A|B).

Select Dim1: A and B

You will eventually run into issues here if your field value has a space or other reserved character in it. So if the field values were ‘A B’ and B, you would need to put double quotes around the field value with spaces: (“A B”|B).

Select Dim1: "A B" and B

You could get a more tricky here and have some action or routine that populates a variable with a pipe delimited list of field values. For example, you have populated the variable vFieldValueList with A|B,  "A B"|B or A*|B, then pass that variable into the Select in Field Search String. The syntax for the Search String will be ='('&'$(vFieldValueList)'&')'.

Select in Field Dim1: vFieldValueList

The result of multiple discrete field value selections is not pretty to the end user and can appear confusing, compared to normal selections. QlikView displays the exact string you used to search for your field values in the Current Selections box, so your Dim1 selections might look like this:

Current Selections Dim1: "A B" and B

To clean this up a bit, you can add a second action to your object to Select Possible in the same field. This will look at the values that have been selected by the Select in Field action and apply the Dim1 selection on top of it as if you had selected those values in a list box. The action on the button would look like this:

Select Possible Dim1

And the resulting Current Selections appear more readable.

Current Selections A B, B

TAGS: QlikView, Presentation

Related News

IS YOUR COMPANY UPGRADING TO QLIKVIEW 12?

Axis Group was approached by a client asking for help...

Read More

Part 1 of this series describes what Qlik Sense does better than QlikView, from the perspective...

Read More