Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to get last selected field value?

I am new to QlikView and I am trying to figure out how I might get the last selected field value from the field [Choices]. My original idea was to call getFieldSelections(Choices), then parse out the last value. However, this function sorts the values, thereby ruining my plan.

I have spent a long time searching, but no luck finding an answer. Your help is appreciated.

Message was edited by: Kevin Kientopp

8 Replies
Colin-Albert

Have you tried getfieldselections()

By last selected field do you mean the order that the user clicked on the fields in the listbox?

I am not sure that this selection order is available.

getfieldselections ( FieldName [, ValueSep [, MaxValues]])

Returns a string with the current selections in a field.ValueSepis the separator to be put between field values.

The default is ', '

Maxvalues is the maximum number of field values to be individually listed.

When a larger number of valuesis selected the format 'x of y values' will be used instead.

The default is 6.

Examples

getfieldselections ( Year )

getfieldselections ( Year, '; ' )

getfieldselections ( Year, '; ' , 10 )

Not applicable
Author

Sorry, "getSelectedFields(Changes)" should have been "getFieldSelections(Changes)" in the question. I have edited it to reflect this.

And yes, I would like to get the last selected field in a listbox.

Colin-Albert

You can get through last selected data set using set analysis to reference the $1 set. This is the equivalent of selecting Back. Not sure this helps.

I suppose the key question is how are you looking to use this last value once you have it?

Not applicable
Author

Could you provide me the line of code doing that? I am unsure of what function I would pass the SetExpression into. Something like "concat({$1} Choices)".

Here is an example of what I am trying to accomplish:

"A", "B", "C", "D" each represent a field.

I have a listbox using windows checkboxes with the values: [A, B, C, D]

They can and will want to select multiple items.

If they check the items in this order: A -> D -> C.

I would like to know that the last selected item was "C".

I would then have a 2nd listbox that displays the values of "C" so that the user may make selections there. I only want 2 listboxes shown at one time in order to keep a clean UI for the user.

Colin-Albert

Hi Kevin, Not sure that I'm missing something in your requirement...

If your data model has associated the data in dimension 1 (A,B,C,...) correctly with the data in dimension2 (A1, A2, B1, B2, C1, C2), selecting C in Dim1 will automatically restrict the available selections in Dim2 to C1,C2 without any other expressions. Selecting A in Dim 1 will only select A1, A2 as associated data in Dim2.

This is how the associative model in QlikView works.

How is your Choices data associated to the other dimension in your data model?

Not applicable
Author

Hi Colin. First, I appreciate your help.

What I would like is something similar to:

Solution: Why do we need so many listboxes | QlikView Tips and Tricks

However, his solution only works if you restrict Dim 1 to "Always One Selected Value".

The reason I would like to do this is because the user would like to create a large pivot table with columns consisting of the items he chooses (ie: "A", "B", "C", etc. from Dim 1) similar to Cognos. This large pivot table will take up the majority of the screen real estate, so I do not have space to display the dozen associated listboxes in case he would like to narrow down the items displayed in the pivot table (ie: Choosing "A", "B", and "C" as columns, but only wanting data relating to "A1").

Colin-Albert

Hi Kevin,

Attached is an example that has some options using Containers to allow you to select groups of list boxes.

This may give you another option to get the layout you require.

Regards

Colin

mambi
Creator III
Creator III

you can use subField function