Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to create a cyclic dynamic listbox linked to a chart?

Will try to explain my problem and research thus far as clearly and concisely as possible.  I'm sorry in advance for how complicated this sounds:

I have two fields, we'll call them 'Company' and 'ConnectedCompanies'.  I have a listbox and a chart.

  • I have to create a listbox that dynamically populates with the possible values of the field 'ConnectedCompanies' when a value in the field 'Company' is selected (with no grey values for 'ConnectedCompanies'). 
  • In addition, if someone were to click on a value in the 'ConnectedCompanies' listbox, that value should replace the selected value in the 'Company' field and that newly selected Company's 'ConnectedCompanies' should populate the listbox.
    • Example
      • 'CompanyA' is selected and is connected to 'Company B, Company C, Company D' (populated in the 'ConnectedCompanies' listbox).
      • Someone selects 'CompanyB' in the 'ConnectedCompanies' listbox. 
      • What should happen is that  'CompanyB' should replace 'CompanyA' in the 'Company' field, and then the listbox should dynamically change to show CompanyB's 'ConnectedCompanies'.  The selection for 'ConnectedCompanies' should then be dropped.
  • In addition, the radar chart should also take these 'ConnectedCompanies' as it's dimension (which I assume will be as easy as just using 'ConnectedCompanies' as the dimension).

I believe this will require the use of macros (such as GetPossibleValues), but I am not certain (if it does not I am extremely delighted).  I have little to no knowledge about macros at all really and a very limited knowledge about VBScript and JScript. I am not even sure how to call a macro after it has been created (I see that the trigger exists to 'Run Macro', but is the macro name the name given after the 'sub' routine is created?'

Any and all help with this task is greatly appreciated!

I have indeed been researching on the QV community about macros and have come up with the following links and guides so far.  Any others that are more thorough would be greatly appreciated.

Macro Tutorial PDF and QVW:

http://community.qlik.com/thread/51099

GetPossibleValues question / answer:

http://community.qlik.com/message/253985

Thank you and Happy New Year!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

See attached qvw. The listbox for Connected Companies uses an expression aggr(ConnectedCompany,ConnectedCompany). The field OnSelect trigger for ConnectedCompany selects the value in Company and clear the selections in ConnectedCompany. If you select more than two companies in ConnectedCompany then the selections in both fields are cleared. For your radar chart you can simply use the ConnectedCompanies dimension.


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

See attached qvw. The listbox for Connected Companies uses an expression aggr(ConnectedCompany,ConnectedCompany). The field OnSelect trigger for ConnectedCompany selects the value in Company and clear the selections in ConnectedCompany. If you select more than two companies in ConnectedCompany then the selections in both fields are cleared. For your radar chart you can simply use the ConnectedCompanies dimension.


talk is cheap, supply exceeds demand
Not applicable
Author

EDIT:  Gysbert -- Your guildines were 100% correct, the problem was a mismatch in my client's data.  Thank you so much for your help, please disregard the below message.

-------------------------------------------------------------------
I am not sure if the correct QVW is attached in your post (see screenshot).  If you still have the example, would you be able to attach it so I may reference?  If this is the correct example, would you be able to explain it a bit more?

Untitled.png

According to the guidelines in your post, I tried the aggr function and it worked great.  I am however having trouble with the OnSelect trigger as I am not sure I have the right syntax.  It is not finding the selection in the 'Company' field.  I have tried using 'only' and 'match' but I do not believe I am using them correctly.

Thank you for your help so far, any more is greatly appreciated, Gysbert.