Check box data filterHi,
I want to have a checkbox where the user can select the option to view the data. I tried using function but something doesn't seem to be correct in my code. Could you please advice?
Names default to here( 1 );
dt = Open( "$SAMPLE_DATA/Time Series/Raleigh Temps.jmp" );
New window(
"Graph with filter",
Data filter context box(
H list box(
V list box(
Text Box( "Enter month:"),
check Box( {"1","2", "3"}, << set(2),
<<SETFUNCTION></SETFUNCTION>
Consumer and Market ResearchDesign of ExperimentsRe: Check box data filterHi @Jackie_ - the invisible option is really only useful for global filters. This option completely removes the display component of the data filters, but local filters depend on the position in the report to determine which reports are being filtered. You can hide the filter in other ways, such as the original visibility option that you used in the initial version of the script:
lb << Visibility("Collapse");Re: Check box data filter@danschikore @jthi
I modified the code- added calling function for clear. If I set the data filter to invisible it doesn't filter the rows. I'm not sure what's wrong . I have also attached the data table
Here's what it looks like
Names Default To Here( 1 );
dt = Current Data Table();
New Window( "Graph with filter",
modal,
Data Filter Context Box(
H List Box(
V List Box(
Text Box( "Select Bins:" ),
Radio Box(
{"1", "2", "N", "A","B","All"},
<<SETFUNCTION></SETFUNCTION>Re: Check box data filterHi @Jackie_ - If you are using the built-in Radio Box display mode, the "None Selected" is the added option to select all levels. This is the state that column filters start in, and also the state that they return to when you Clear the filter item. When a filter item is "Clear", it does not participate in the filter, and the saved script does not contain a Where clause for that column.
If you are needing to do this from your custom filter display, calling <
Re: Check box data filterMost likely the issue is with the where clause, I would suggest adding reference to checkbox to help you with debugging and see how it behaves and then try to get the function working outside the function. After you get that going as you want, then try to implement it inside the function.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Time Series/Raleigh Temps.jmp");
New Window("Graph with filter",
Data Filter Context Box(
H List Box(
V List Box(
Text Box("Enter month:"),
cb = Check Box({"1", "2", "3"}, // add reference here for easier debugging
<<SET></SET>
If you could use Hide and Exclude (or rowstates) here it would be much easier than using local data filter, but this isn't always possible
Re: Check box data filter@danschikore Many Thanks!
Quick question- I want to add an option in radio box "Show All" which will show all the months data. Any suggestions?
Re: Check box data filterIn general I think it works best to fully evaluate exprs within the Where clause that are constant, before you send the message to the data filter. In this small excerpt, I also switched from a Check Box to a Radio Box. The problem with a Check Box is that you can select ranges that may not actually be possible in the filter (select 1,3, but not 2).
radio Box( {"1","2", "3"}, << set(2),
<<SETFUNCTION></SETFUNCTION>
You might consider changing the modeling type for the Month Number in this example to Nominal/Ordinal (either in the data table or just for the filter, in the red-triangle menu). This would give you more flexibility in the Where clause that would support Check Box type behavior, or you may be able to simply use the built-in Check Box and Radio Box modes of the filter. This is a JMP 16 example:
dt = Open( "$SAMPLE_DATA/Time Series/Raleigh Temps.jmp" );
dt << Graph Builder(
Size( 400, 563 ),
Show Control Panel( 0 ),
Variables(
X( :"Month/Year"n ),
Y( :Temperature ),
Y( :Predicted Temperature, Position( 1 ) )
),
Elements( Line( X, Y( 1 ), Y( 2 ), Legend( 23 ) ) ),
Local Data Filter(
Add Filter(
columns( :Month Number ),
Modeling Type( :Month Number, Nominal ),
Where( :Month Number == {1, 3} ),
Display(
:Month Number,
N Items( 5 ),
"Check Box Display",
Find( Set Text( "" ) )
)
)
)
);