cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Georgios_Tsim
Level III

Interactive / Dynamic Filtering or Choice Menu

I have a table named dt. I take the unique values of some columns and I create the following menu that gives the ability to the end user to filter the dt table based on the values of the columns and take a subset of this.

Georgios_Tsim_0-1721912378487.png


However, taking the unique values of its column is risky because you may end up choosing a combination of attributes that doesn't exist in the table. 

Is there any way to make this menu interactive or dynamic so that it narrows down the available choices as the end user makes some choices?

In general, is there any way to handle this problem of ending up having an empty table because the initial dataset does not contain all the combinations of the unique values of the attributes?

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Interactive / Dynamic Filtering or Choice Menu

You could try utilizing conditional data filter but it might mess with your layout / require a bit extra work to get it look similar.

-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Interactive / Dynamic Filtering or Choice Menu

You could try utilizing conditional data filter but it might mess with your layout / require a bit extra work to get it look similar.

-Jarmo
jthi
Super User

Re: Interactive / Dynamic Filtering or Choice Menu

Here is a quick example. I would suggest making the referencing more robust and possibly utilizing local data filter instead of global. Also you should parametrize this (wrapping, instructions, ...)

 

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Animals.jmp");

nw = New Window("",
	V List Box(align("center"),
		Text Box("Animals Study Evaluation", << Set Base Font("Title")),
		Text Box("Add-in version 1.0", << Set Base Font("Heading")),
		Text Box("Documentation report: xxxxxx", << Set Base Font("Heading")),
		Panel Box("Study Selections",
			Button Box("Start Over", f << Clear);
			f = dt << Data Filter(
				Conditional,
				Show Controls(0),
				Show Modes(0),
				Show Histograms and Bars(0),
				Add Filter(
					columns(:season, :species, :subject),
					Where(:season == "fall"), // force conditional filter order
					Where(:species = "COYOTE"),
					Where(:subject= "1"),
					Display(:season, N Items(4)),
					Display(:species, N Items(2), "List Display"),
					Display(:subject, N Items(3), "List Display")
				)
			)
		)
	)
);

Window("")["Data Filter",BorderBox(6)] << Sib Prepend(
	V List Box(
		Text Box("Selection of Seasons", << Set Font Size(12), << Set Font Style("Bold Italic")),
		Text Box("Please select which seasons to use for the analysis. Multiple seasons can be selected by holding 'ctrl' down while pressing multiple seasons.", << Set Wrap(400))
	)
);
Window("")["Data Filter",BorderBox(6)] << Sib Append(Spacer Box(Size(0, 20)));


Window("")["Data Filter",BorderBox(7)] << Sib Prepend(
	V List Box(
		Text Box("Selection of Species", << Set Font Size(12), << Set Font Style("Bold Italic")),
		Text Box("Please select which Species to use for the analysis. Multiple Species can be selected by holding 'ctrl' down while pressing multiple Species.", << Set Wrap(400))
	)
);
Window("")["Data Filter",BorderBox(7)] << Sib Append(Spacer Box(Size(0, 20)));

Window("")["Data Filter",BorderBox(8)] << Sib Prepend(
	V List Box(
		Text Box("Selection of Subjects", << Set Font Size(12), << Set Font Style("Bold Italic")),
		Text Box("Please select which Subjects to use for the analysis. Multiple Subjects can be selected by holding 'ctrl' down while pressing multiple Subjects.", << Set Wrap(400))
	)
);

Window("")["Data Filter",BorderBox(3)] << Visibility("Collapse");
Window("")["Data Filter",CheckBoxBox(1)] << Visibility("Collapse");
Window("")["Data Filter",BorderBox(1)] << Visibility("Collapse");
nw[Outline Box(1)] << Set Title("");


// To force the order of conditional filtering
// https://community.jmp.com/t5/JMP-Wish-List/Option-to-make-Conditional-Data-Filter-work-from-top-to-bottom/idi-p/746949
f << (Filter Column(:subject) << Clear Selection);
f << (Filter Column(:species) << Clear Selection);
f << (Filter Column(:season) << Clear Selection);

jthi_1-1721979250690.png

There are also some places where JMP utilizes something like this (like Sample Index) but they might also have access to some nicer implementations than us.

 

-Jarmo
Georgios_Tsim
Level III

Re: Interactive / Dynamic Filtering or Choice Menu

Is it possible to use "or" statements between 2 conditions of data filtering? The Conditional data Filter uses "and" statements and filters out the data dynamically. But what if my conditions are like the following:

Condition_of_column1 and (Condition2_of_column2 or Condition3_of_column3)

jthi
Super User

Re: Interactive / Dynamic Filtering or Choice Menu

Might not be possible when using conditional data filters

-Jarmo