Link to home
Start Free TrialLog in
Avatar of pw05
pw05

asked on

Programmatically expanding/collapsing twisties

Hi, I have a view where the first three columns are categorized.  The view uses the "Collapse all when database is first opened" option.  How can I programmatically expand all categorized columns except the last categorized one?  Thanks.

C1,C2,C3 categorized columns
E expanded twistie
C collapsed twistie

C1 C2 C3
E
     E
          C
          C
     E
          C
          C
E
     E
Avatar of Bozzie4
Bozzie4
Flag of Belgium image

Wow.  That's a difficult one.

It's possible, though.  Put this in PostOpen:

CurrentView := @ViewTitle;
@If(CurrentView != "YourView"; @Return(""); "");
res := @dbcolumn("":"nocache";@dbname;CurrentView;1);
key:=@if(@iserror(res);@return("");@subset(res;-1));
@Command( [ViewExpandAll] ) ;
@Command([OpenView]; CurrentView ; key);
@Command([ViewCollapse])
Avatar of pw05
pw05

ASKER

Sorry, I'm a beginner at LotusScript, so I'm not sure what's wrong here - I'm getting a bunch of errors along the lines of "Unexpected: =; Expected: Statement" (either unexpected = or @)

Is there something I'm missing?  Thanks.
In the PostOpen Event you must select "Run Client Formula", not "Run Client LotusScript".

Bozzie, very good !!

Only, I'd delete the first @If statement.

Avatar of pw05

ASKER

Oh, thanks.  It doesn't work for me though - when I open the view, everything is collapsed.  Is there something else I need to set in the view properties?
If your categories are not unique, then Bozzie4's code doesn't work...

---
Oops!! Sorry!
I misunderstood your question!!
Forget everything I said( and Bozzie4 too ) till now.

You want the first two columns expanded and the rest collapsed while I thought you wanted the all the categories (rows)expanded except the last one (which is what Bozzie4's code does).
ASKER CERTIFIED SOLUTION
Avatar of Andrea Ercolino
Andrea Ercolino

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ah yeah, I misunderstood the question too ....