It might help to add an example to demonstrate the question. (See JSL below)
The example uses the AdverseR data from the JMP sample data. The objective is to produce a dashboard like this:
You can see there is a Data Filter on SEX. And there is a column switcher that switches the "response" variable that is summarised in the two Tabulate reports and the Distribution.
The first Tabulate (left) gives the Mean response for each Treatment Group.
The second Tabulate (right) gives the mean % change in response for each Treatment Group relative to the PBO group. This runs from a summary table ("dtSumm") of the means of each response for each Treatment Group.
The problem is that the Data Filter works on everything apart from this second Tabulate report. What would be ideal is if dtSumm could summarise only the data that meets the Data Filer criteria. And dtSumm would be re-created when selections in the Data Filter change.
Is that possible?
// Open the data table
dt = Open( "$SAMPLE_DATA/AdverseR.jmp" );
//Define cols as the list of columns for column switcher to use
//This is essentially hard-coding the columns that will be used in the dashboard
//Edit the items in this list to change the columns used in the dashboard
cols = {"DAY ON DRUG", "AGE", "WEIGHT", "ADR DURATION"};
//Define num as the number of columns in the list, cols
num = length(cols);
// We create a separate data table for treatment group means
// Get table, dtSumm, of means by group for each column in cols
dtSumm = dt << Summary (
Group (:Name("TREATMENT GROUP")),
Mean ( eval( cols ) ),
statistics column name format( "column" ),
Link to original data table( 1 ),
invisible
);
// Add RC columns for each column in cols to dtSumm
//This works by getting the mean for "PBO" treatment group for each
For( i = 1, i <= num, i++,
mean0 = Mean(Column(cols[i])[(dtSumm << get rows where( :"TREATMENT GROUP" == "PBO"))]);
dtSumm << New Column(
Char(cols[i]||"_RC"),
Formula( ( ( ( column( cols[i] )[]) - ( eval(mean0) ) ) / ( eval(mean0) ) ) * 100 )
);
);
// Create dashboard with tables and Distribution plot
mainWindow=New Window( "Example",
H List Box(
dt << Current Data Table() << Data Filter(
Location( {55, 48} ),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) ),
Add Filter( columns( :SEX ) ) //
);
,
table1= dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table(
Analysis Columns(
Column( cols[1] )
),
Statistics( Mean, N )
),
Row Table( Grouping Columns( :TREATMENT GROUP ) )
)
);
,
table2= dtSumm << Tabulate(
Change Item Label( Statistics( Mean, "%Rel Change" ) ),//Changes heading from "Mean"
Show Control Panel( 0 ),
Add Table(
Column Table( Analysis Columns( Char(cols[1]||"_RC") ), Statistics( Mean ) ),
Row Table( Grouping Columns( :TREATMENT GROUP ) )
)
);
,
dist0 = dt << Distribution(
Continuous Distribution(
Column( cols[1] ), //dt_c_col[1] uses first in column list
Always use column properties( 1 ),
Process Capability( 0 )
),
Histograms Only,
SendToReport(
Dispatch( {}, "Distribution", OutlineBox ),
Dispatch( {}, "Process 1", OutlineBox, {Close( 1 )} )
)
)
)
);
// Add a column switcher to table1
cs = table1 << Column Switcher(
cols[1],
cols
);
// Link column switchers at each platform - JMP 15 solution
cs1 = table2 << Column Switcher(
Char(cols[1]||"_RC"),
eval list(dtSumm << Get Column Names( String ))[(num+3)::(num+2+num)],
Close Outline( 1 )
);
cs2 = dist0 << Column Switcher(
cols[1],
cols,
Close Outline( 1 )
);
mainWindow[ListBoxBox( 1 )] << Set Script(
var = mainWindow[ListBoxBox( 1 )] << Get Selected;
cs1 << Set Current(Char(var[1]||"_RC"));
cs2 << Set Current(var[1]);
);