Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
john_duffy
Partner - Creator III
Partner - Creator III

Append to alternate state listbox


Hello All.

Is there a way to append to a listbox in an alternate state based on selections in a chart in a different state?

I have attached a sample application to demonstate the requirement.

In the attached application, the user would like to be able to select a Case in the Sales chart (inherited state) and have that case added to the listbox (alternate state State1).  Then clear all Cases and select another Case in the Sales chart and have that Case appended to the listbox.

The Copy to State1 button will copy the values to the listbox, however, it will overwrite the existing values in the listbox.

Example of what I am trying to accomplish:

Select Case 2 in the Sales chart.

Copy this selection to the listbox.

Clear the Cases.

Select Case 4 in the Sales chart.

Append this selection to the listbox.  The listbox should now have Cases 2 and 4 selected.

Keep in mind that the attached application is very simple.  The production application is much more complicated.  The users will be making hundreds of selctions and want to be able to save the selections between multiple sessions.

We are using QV11 SR2.

Any help with this would be greatly appreciated.

Thanks,

John.

1 Solution

Accepted Solutions
simondachstr
Luminary Alumni
Luminary Alumni

Have a look at the attachment.

a) Select 1 in Case 1

b) Make your selection in the Chart

c) Append your selection using the button

As stated above, there needs to be a selection present in both states in order for it to work properly.

View solution in original post

6 Replies
simondachstr
Luminary Alumni
Luminary Alumni

You can append & pass the selection from the current state to State 1 by using the following in the "Select in Field trigger":

='('& Concat(distinct {[State1]+$} Case,'|') & ')'

This will take the selections from State 1 and from $, form a string out of both of them and pass it to State 1.

There's one issue though, which is QlikView releated: If nothing is selected, in either $ or State 1, this implies that everything will be passed. To solve this, I recommend using some sort of Conditional Expressions using GetSelectedCount or similar. But this strongly depends on how you intend to use this feature.

john_duffy
Partner - Creator III
Partner - Creator III
Author

Hi Martin.

Thanks for the reply.

I still can't seem to get the listbox to append using your suggestion.  Could you please apply it to my sample application and re-post.

Thanks,

John.

simondachstr
Luminary Alumni
Luminary Alumni

Have a look at the attachment.

a) Select 1 in Case 1

b) Make your selection in the Chart

c) Append your selection using the button

As stated above, there needs to be a selection present in both states in order for it to work properly.

john_duffy
Partner - Creator III
Partner - Creator III
Author

Hi Martin.

Thanks again for the response.

I am able to get my application working using your suggestion.  I will use the Copy State Contents action for the first selection and then the concat search string to append subsequent selections.

A couple of quick questions:

Do you know if there is a limit to the number of values that can be used by the concat statement?  Our users are going to select 200 - 300 different values.

In order to display/hide the Copy State Contents and concat buttons, I need to determine whether or not a selection has been made in the alternate state.  The getselectedcount will not work across different states.  Also, our users want to combine expressions from various states on one chart.  I've read numerous posts on trying to get a selected count on an alternate state.  So far, no luck.  This issue is when no selections are made, any of the solutions count all values.  Any ideas?

John.

simondachstr
Luminary Alumni
Luminary Alumni

Hm.. I don't know of any limitations for the concat() function. If you try and use =Concat(ValueLoop(1,500,1),',')) you will see that all 500 values are displayed so you should be fine with the required 200-300 values.

I agree GetSelectedCount just as GetFieldSelection can't address a specific alternate state, therefore concat is the only viable option.

However, I must warn you that working with alternate states might become very calculation intensive in big applications. Make sure to test your app properly before investing too much time with this option.

Cheers,

Martin

john_duffy
Partner - Creator III
Partner - Creator III
Author

Thanks again Martin.

I will be sure to test the application performance with a full data set.