Hi all
Hope you can help me with a large problem, my scrip is making a new window with a report header, then the user is putting in the columns for analysis and click OK. From that analysis I make a "Combined Data Table" but it always fails because the scrip it not waiting for the platform to finish. So my report generation stops.
I know the script works when I use a list for named columns or for a list of numeric columns, but that solution is not useful in this case.
Thanks Jakob
Script Below here
//!
Names Default To Here( 1 );
col = Current Data Table();
nw = New Window( "Measurering Report",
//Header for report
nw1 = V List Box(
Lineup Box(
2,
Outline Box( "Report Number" ),
Text Edit Box( "", <<Set Width( 700 ) ),
Outline Box( "Drawing Number" ),
Text Edit Box( "", <<Set Width( 700 ) ),
Outline Box( "KOM Number" ),
Text Edit Box( "", <<Set Width( 700 ) ),
Outline Box( "Supplier and Form Number" ),
Text Edit Box( "", <<Set Width( 700 ) ),
Outline Box( "Program Name" ),
Text Edit Box( "", <<Set Width( 700 ) ),
Outline Box( "Measurement Equipment" ),
Text Edit Box( "", <<Set Width( 700 ) ),
Outline Box( "Comments" ),
Text Edit Box( "
", <<Set Width( 700 ) ),
Outline Box( "Signature & Date" ),
Text Edit Box( "
", <<Set Width( 700 ) )
),
Text Box( " " )
),
dt = Current Data Table();
obj = Variability Chart(
Ignore Platform Preferences( 1 ),
Model( "Crossed" ),
Historical Sigma( 0 ),
Connect Cell Means( 1 ),
Mean of Std Dev( 1 ),
Name( "Reduced Gauge R&R Report" )(1),
Name( "Gauge R&R" )(6, 0.24),
Name( "Gauge R&R Report" )(1),
Misclassification Probabilities( 0 ),
Variance Components( 0 ),
Mean Plots( 1 ),
Std Dev Plots( 1 ),
Automatic Recalc( 1 ),
);
);
//if(OK button = run / No Ok wait(1));
dt1 = Current Report()[Outline Box( "Variability Gauge" )][Outline Box( "Gauge R&R" )][Table Box( 2 )] <<
Make combined Data Table;
Wait( 10 );
dt1 << Set name( "GRR1.jmp" );
Data Table( "GRR1.jmp" );
:Y << Set Name( "# Number" );
Data Table( "GRR1.jmp" );
Column( 2 ) << Set Name( "Results" );
Data Table( "GRR1.jmp" );
Column( 3 ) << Set Name( "Data" );
Data Table( "GRR1" ) << Split(
Split By( :Data ),
Split( :Results ),
Group( :Name( "# Number" ) ),
Sort by Column Property
);
dt2 = Current Data Table();
dt2 << Set name( "GRR2.jmp" );
Data Table( "GRR2" ) << Subset(
All rows,
columns( :Name( "# Number" ), :k, :Name( "Precision/Tolerance Ratio = RR/(USL-LSL)" ) )
);
dt3 = Current Data Table();
dt3 << Set name( "GRR3.jmp" );
Data Table( "GRR3.jmp" );
Column( 3 ) << Set Name( "PT Ratio" );
Data Table( "GRR3.jmp" );
New Column( "PT Ratio Result",
Character,
"Nominal",
Set Property( "Value Colors", {"Accepted" = 4, "Not Accepted" = 19, "Partly Accepted" = 41} ),
Formula( If( :PT Ratio <= 0.3, If( :PT Ratio <= 0.1, "Accepted", "Partly Accepted" ), "Not Accepted" ) ),
Color Cell by Value,
Set Selected,
Set Display Width( 200 )
);
Close( "GRR1.jmp", No Save );
Close( "GRR2.jmp", No Save );
Data Table( "GRR3.jmp" ) << Sort( By( :Name( "# Number" ) ), Order( Ascending ), Output Table( "GRR Report" ) );
Close( "GRR3.jmp", No Save );
Data Table( "GRR Report.jmp" ):PT Ratio << Format( "Fixed Dec", 20, 2 );
Data Table( "GRR Report.jmp" ) << Select Columns( all );
dt = Data Table( "GRR Report.jmp" );
Get Window( nw )[Text Box( 9 )] << Sib Append( H List Box( Outline Box( "GRR Report", dt << Get As Report ) ) );
nw[Table Box( 1 )] << Set Scrollable( 0, 0 );
wlist = Get Window List() << Get Window Title();
choose_window = Function( {},
win = New Window( "Select a Report",
<<Modal,
hb = H List Box(
Panel Box( "Select a report window",
tcf = List Box( wlist, Max Selected( 1 ), chosen = tcf << Get Selected() )
),
)
);
chosen;
);
chosen = choose_window();
w = Window( chosen[1] );
w << Report;
//you might need to scale the report to fit in the pdf page
w << Set page setup( margins( 0.2, 0.5, 0.2, 0.5 ), scale( .75 ), Landscape( 1 ), paper size( "A4" ) );
path = Pick Directory( "Select a directory" );
Set Default Directory( path );
w << Save Interactive HTML();
w << Set page setup( margins( 0.2, 0.5, 0.2, 0.5 ), scale( .75 ), Landscape( 1 ), paper size( "A4" ) );
w << save pdf();
Data Table( "GRR Report" ) << save( "" );
nt = Current Data Table();
nt << Save();