- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Preset filters as button boxes
I am trying to create button boxes where I can have set parameters that the global filter is assigned to.
For the example below I would like a button for females only and another one with male and height greater than 60
dt = Open( "$SAMPLE_DATA/big class.jmp" );
gra1=hlistbox(dt<<Graph Builder(
Size( 528, 450 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 11 ) ), Smoother( X, Y, Legend( 12 ) ) )
));
tab1=hlistbox(dt<<Tabulate(
Show Control Panel( 0 ),
Full Path Column Name( 1 ),
Add Table(
Column Table( Analysis Columns( :height ) ),
Row Table( Grouping Columns( :name, :sex ) )
)
));
fil1=hlistbox(dt<<Data Filter(
Auto clear( 1 ),
Show Histograms and Bars( 0 ),
Mode( Show( 0 ) ),
Add Filter(
columns( :sex, :age, :height ),
Display( :age, N Items( 6 ) ),
Display( :height, Height( 20 ) )
)
));
win1=New Window("Example", hlistbox(fil1, vlistbox(gra1, tab1)));
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Preset filters as button boxes
This does show few different options
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/big class.jmp");
gra1 = H List Box(
dt << Graph Builder(
Size(528, 450),
Show Control Panel(0),
Variables(X(:height), Y(:weight), Overlay(:sex)),
Elements(Points(X, Y, Legend(11)), Smoother(X, Y, Legend(12)))
)
);
tab1 = H List Box(
dt << Tabulate(
Show Control Panel(0),
Full Path Column Name(1),
Add Table(Column Table(Analysis Columns(:height)), Row Table(Grouping Columns(:name, :sex)))
)
);
fil1 = H List Box(
df = dt << Data Filter(
Auto clear(1),
Show Histograms and Bars(0),
Mode(Show(0)),
Add Filter(columns(:sex, :age, :height), Display(:age, N Items(6)), Display(:height, Height(20)))
)
);
df << Match(Filter Columns(:sex, :age, :height), Where(:sex == "F"));
df << add favorites("F only");
df << Clear;
win1 = New Window("Example",
V List Box(
Lineup Box(N Col(2),
Button Box("F Only",
df << Apply Favorites("F only")
),
Button Box("M, height >= 60",
df << (Filter Column(:sex) << Where(:sex == "M"));
df << (Filter Column(:height) << Extend Where(:height >= 60));
)
),
H List Box(
fil1,
V List Box(
gra1
, tab1
)
)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Preset filters as button boxes
Could you maybe just utilize Favorites?
If you wish to have buttons, you could still utilize favorites (add them first and then make buttons apply those favorites). Look for Data Filter (on the left) from scripting index for all sorts of useful options:
Using favorite (this example gives pretty good idea of what you could do)
Using Where:
https://www.jmp.com/support/help/en/18.0/#page/jmp/data-filter-messages.shtml#
And for buttons you can use Button Box()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Preset filters as button boxes
Thanks, I would like to have buttons visible rather than favorites.
I was trying to use filter columns and match in a function to no avail!
I have gone through the scripting index and searched everywhere, used the new learnbot from the store as well as ChatGPT!
Seems odd it has not been implemented before.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Preset filters as button boxes
This does show few different options
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/big class.jmp");
gra1 = H List Box(
dt << Graph Builder(
Size(528, 450),
Show Control Panel(0),
Variables(X(:height), Y(:weight), Overlay(:sex)),
Elements(Points(X, Y, Legend(11)), Smoother(X, Y, Legend(12)))
)
);
tab1 = H List Box(
dt << Tabulate(
Show Control Panel(0),
Full Path Column Name(1),
Add Table(Column Table(Analysis Columns(:height)), Row Table(Grouping Columns(:name, :sex)))
)
);
fil1 = H List Box(
df = dt << Data Filter(
Auto clear(1),
Show Histograms and Bars(0),
Mode(Show(0)),
Add Filter(columns(:sex, :age, :height), Display(:age, N Items(6)), Display(:height, Height(20)))
)
);
df << Match(Filter Columns(:sex, :age, :height), Where(:sex == "F"));
df << add favorites("F only");
df << Clear;
win1 = New Window("Example",
V List Box(
Lineup Box(N Col(2),
Button Box("F Only",
df << Apply Favorites("F only")
),
Button Box("M, height >= 60",
df << (Filter Column(:sex) << Where(:sex == "M"));
df << (Filter Column(:height) << Extend Where(:height >= 60));
)
),
H List Box(
fil1,
V List Box(
gra1
, tab1
)
)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Preset filters as button boxes
Thank you so much!!!