Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
marleygt
Creator
Creator

Listbox - Expand all always active

Hi all!

Question is seemingly easy, but is not for the general situation.

So I begin to ask this and then we'll see what happens .

Is possibile to keep expanded a treeview listbox, whatever could be the selections, but with Aggr function active?

In the attachment a sample of what I need.

(treeview expanded, aggr function, and the goal is to let the treeview always expanded).

Suggestions?

Thank you!

Alex

1 Solution

Accepted Solutions
Not applicable

Use this expression for ListBox:

=aggr(only({1}If(Len(Trim(SubField(SelectionPath, '/', -1))) > 0, SelectionPath)),SelectionPath)

View solution in original post

7 Replies
Not applicable

Use this expression for ListBox:

=aggr(only({1}If(Len(Trim(SubField(SelectionPath, '/', -1))) > 0, SelectionPath)),SelectionPath)

rubenmarin

Hi Alex, PFA, I tried to simulate the always-expanded tree

marleygt
Creator
Creator
Author

Hi smakovskyi & RubenMarin!

Thank you for your fast and good reply.

The meaning is good, in fact, the treeview remain open...BUT!

I haven't reach my orginal goal (and I am realizing that's my fault, I didn't say something important).

The orginal expression was:

=aggr(If(Len(Trim(SubField(SelectionPath, '/', -1))) > 0, SelectionPath),SelectionPath,SelectionPath)

and reasons are;

Aggr= cause I need to show only data and subdata of one specified major level (who can change randomly by customers)

In the example attached now, I saved with "Drinks" in Main Listbox, and in SelectionPath, only data related to Drinks are displayed.

Len-Trim= cause some subdata could have blanks and in the treeview they fit bad.

With your solution (that is not so bad at all), the problem is that customer could see "Food" stuff, if "Drinks" are selected and viceversa.

This is the bad news.

Good one is that any others solution applicable are allowed.

...do we have some?

Not applicable

Well, it's impossible in QV to make such listbox 'Always expanded'. When you choose another option - for example when you use another expression, like:

=aggr(only({$<SelectionPath=>}If(Len(Trim(SubField(SelectionPath, '/', -1))) > 0, SelectionPath)),SelectionPath)

Then your listbox will Expand and Collapse on most selexts in other than SelectionPath field.

Otherwise there should be used some workarounds - substitution like RubenMarin‌ mentioned, or with pivot table, or some another way. But it won't be a Listbox.

marleygt
Creator
Creator
Author

Got it.

So no alternative in listbox.

Main problem is that in real project, "Main" inlcudes a lots of data...that's the main reason for needing a restricted selection based on the first listbox choose (Main) ; secondly, the idea behind is analysis on Specified Area made by customer and if the listbox shows alternatives, the selected area market could change on selection of any data excluded. (for this I've tried the "hide exclude" and as well as be looks ugly, it only shows one selection and no parents above (customer ask to see for istance, "Swordifish" belonging to "Fish" category..."hide exclude" will cover also "Fish" category if active).

Mmmhhh....so do you think I could try out some other ways, like pivot table?

Not applicable

Yes, you could. But do understand that each decision has it's limits.

Listbox has unlimited tree levels, but doesn't have option 'Always expanded'.

Pivot table has option 'Always expanded', but has fixed size of tree levels...

marleygt
Creator
Creator
Author

Ok.

Need to make some test in pivot and then I will decide for the best one.

Thank you anyway.

Have a nice day!

Alex