Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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.
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.
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.
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.
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.
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
Thanks again Martin.
I will be sure to test the application performance with a full data set.