I did some cleanup on the first part of the script and it hopefully gives you some ideas regarding scripting and writing JSL
Names Default To Here(1);
new_folder = "MYFOLDER";
// Checking for scriptable should be unnecessary
dt1 = Open("XXXXX.csv");
// Datatable(dt1) is unnecessary in 99% of cases
// Use << Get Rows Where instead of Select Where with Rows() in subset
// Use output table() to make debugging much easier
dt2 = dt1 << Subset(Rows(dt1 << Get Rows Where(:X == "1" & :"Y"n == "2" & :Z == "3")), Selected Columns(0), Output Table("MainDataTable"));
dt3 = Open("YYYY.csv");
dt3 << Set Name("SpecTable");
// simpler in this case
saveloc_dt2 = new_folder || "\MainDataTable.csv";
dt2 << Save(saveloc_dt2);
saveloc_dt3 = new_folder || "\SpecTable.csv";
dt3 << Save(saveloc_dt3);
// You can send messages directly to data table, do not use current data table() if possible
cc_expr = Expr(dt2 << Control Chart Builder(
Show Control Panel(0),
Show Capability(0),
Size(700, 450),
Show Excluded Region(0),
Variables(Y(:X)),
Local Data Filter(Add Filter(columns(:Z), Display(:A, Find(Set Text(""))))),
Chart(Position(1), Limits(Shade Zones(0)))
));
ps_expr = Expr(dt2 << Process Screening(
Process Variables(
:A,
:B,
:C,
Grouping(:Y),
Control Chart Type("Indiv and MR"),
Within Sigma(0),
Overall Sigma(0),
Stability Index(0),
Show Tests(0),
Out of Spec Count(1),
Out of Spec Rate(1),
Latest Out of Spec(0),
N Subgroups(0),
Ppk(1),
Cp(1),
Cpk(1),
Cpm(1),
Spec Limits(1),
Use Limits Table(1, Data Table("SpecTable"), Process Variables(:Process), Grouping(:Z), LSL(:LSL), USL(:USL), Target(:Target), Go),
Goal Plot(0, Capability Lines(1.33), Shade Levels(0)),
Process Performance Graph(0)
)
));
nw = New Window("My report",
V List Box(
cc = cc_expr,
ps = ps_expr
)
);
One option of building reports is to wrap the platform calls with Expr() and then call those expressions inside new window You can also skip expressions and just build the window with platform calls (or use few other methods)
nw = New Window("My report",
V List Box(
cc = dt2 << Control Chart Builder(
Show Control Panel(0),
Show Capability(0),
Size(700, 450),
Show Excluded Region(0),
Variables(Y(:X)),
Local Data Filter(Add Filter(columns(:Z), Display(:A, Find(Set Text(""))))),
Chart(Position(1), Limits(Shade Zones(0)))
),
ps = dt2 << Process Screening(
Process Variables(
:A,
:B,
:C,
Grouping(:Y),
Control Chart Type("Indiv and MR"),
Within Sigma(0),
Overall Sigma(0),
Stability Index(0),
Show Tests(0),
Out of Spec Count(1),
Out of Spec Rate(1),
Latest Out of Spec(0),
N Subgroups(0),
Ppk(1),
Cp(1),
Cpk(1),
Cpm(1),
Spec Limits(1),
Use Limits Table(1, Data Table("SpecTable"), Process Variables(:Process), Grouping(:Z), LSL(:LSL), USL(:USL), Target(:Target), Go),
Goal Plot(0, Capability Lines(1.33), Shade Levels(0)),
Process Performance Graph(0)
)
)
)
);
I suggest you check out Scripting Guide from JMP Help. No need to read through everything but take a peak here and there to see what it contains.
-Jarmo