I like the idea, but obviously there's something I don't understand in your solution, as it crashes when I try to run it.
Here's what I have so far:
Names Default to Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb1 = dt << Graph Builder(
Graph Spacing( 5 ),
Variables( X( :sex ), Y( :height ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
gb2 = dt << Graph Builder(
Graph Spacing( 5 ),
Variables( X( :sex ), Y( :height ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
);
df1 = gb1 << Local Data Filter(
Add Filter(
columns( :sex ),
Where( :sex == "M" ),
Display( :sex, N Items( 2 ) )
)
);
df2 = gb2 << Local Data Filter(
Add Filter(
columns( :sex ),
Where( :sex == "F" ),
Display( :sex, N Items( 2 ) )
)
);
broadcastFilter = Function( {},
//get the script
filterScript = df1 << get Script();
//search for the "Add filter" part
For( i = 1, i <= N Arg( filterScript ), i++,
If( Head( Arg( filterScript, i ) ) == Expr( Add Filter() ),
filterExpression = Arg( filterScript, i )
)
);
// broadcast it to the other Data filter
Eval(
Substitute(
Expr(
df2 << Start Over << _filter_
),
Expr( _filter_ ), Name Expr( filterExpression )
)
);
);
// activate the Filter Change Handler
rs = df1 << Make Filter Change Handler( broadcastFilter );
Here's the error: "broadcastFilter has 0 parameters () but 1 arguments (18) were supplied". Any idea what it's talking about? I don't think I'm supplying any arguments in that last line...