Collapse/Expand Category Levels via Scripting

2.89K viewsScripting

Is there a way to collapse or expand items via Scripting?

Here is what I’m trying to do… I have a model where we have a category called DMAGEO. The DMAGEO starts with the Region, sub grouped to a Market, grouped to an Assignment Group and finally grouped down to a GEOGRAPHY (4th Level). Is there a way to Collapse ALL but 1 Market, or Assignment Group?

Also, will need to be able to EXPAND ALL afterwards as well.

Thank you for your time. Any help will be greatly appreciated!


Hi ag4360,

I’m not sure if this solves your problem. I’ve tried to document this technique as best as possible – let me know if you can’t figure it out.

From what I can gather you are looking for an easy way to control what is visible on a canvas. I have been playing around with some of these problems myself and came up with this solution, however I cant tell if this is exactly what you’re looking for.

Let me know your thoughts on this.



So far I’ve only managed to collapse a group but I have to clarify it in the code. See below where Matrix 1, category B has Group 1, Group 2, etc.,.. with 2 items each.

This code collapses Group 1 and leaves me Group 2 with my 2 items.
|Matrix1::B.Group 1|.collapsed = "True"

What I want to do is collapse all but Group 1. Then Expand all without having to clarify what is collapsed.

Hope this explains a little better what I’m needing help with.