Hi all,
I try to generate a report in which I have 2 charts per "parameter" for median and stdev, and I'm struggling adding lines in it.
The "Summary.jmp" file contains multiple columns with a "Lot" (I use it as the X axis), and then several parameters, each of them having a column for median with suffix "_Q50" and one with suffix "_StdDev".
I have a list of parameters that have in addition Target, LowerSpecsLimit and UpperSpecsLimits (TGT, LSL, USL). I don't have them directly in the columns as they can change based on the "Lot" set I select and I would actually prefer not touching the file at all, to make sure I don't leave a mess behind if the script fails for whatever reason.
I also have Dispatch to replace the titles and axes labels.
I then have a function that generates the median and stdev charts on top of each other, charts are fine.
But no matter what I put in the dispatch section, I get an error
"Cannot find ScaleBox ... at {}"
and all the TextEditor dispatch seem to do nothing (not even an error, but I assume the function stops at the first dispatch error?)
I generated the charts and made manual modification to check the resulting script, and it didn't help. It uses "Param1_Q50" directly, and even that does not work when I put it back in the script!
Here is the code:
NamesDefaultToHere(1);
Open("Summary.jmp");
GraphXSize = 800;
GraphYSize = 600;
ParamsList = {
{"Param1", "Name1", 0, -10, 10},
{"Param2", "Name2", 50, 25, 75}
};
ParamGraph = Function (
{parameter, title, tgt=".", lsl=".", usl="."},
LOCAL(
{Default Local},
medianCol = parameter || "_Q50";
stdevCol = parameter || "_StdDev";
gb = Graph Builder(
Size(GraphXSize,GraphYSize),
Show Control Panel(0),
Show Footer(0),
Show Legend(0),
Variables(
X(:Name("Lot")),
Y(Column(medianCol)),
Y(Column(stdevCol)),
Color(:Lot)
),
Elements(
Points(X, Y, Legend(6))
),
SendToReport(
Dispatch(
{},
medianCol,
ScaleBox,
{IF(tgt != ".", Add Ref Line(tgt, "Solid", "Black", "TARGET", 1)),
IF(lsl != ".", Add Ref Line(lsl, "Solid", "Purple", "LSL", 1)),
IF(usl != ".", Add Ref Line(usl, "Solid", "Red", "USL", 1))}
),
Dispatch({}, "graph title", TextEditor, {Set Text(title)}),
Dispatch({}, "Y title", TextEditor, {Set Text("Median")}),
Dispatch({}, "Y 1 title", TextEditor, {Set Text("Std Dev")})
),
);
);
);
New Window("Summary - Report",
For(i=1, i<=Length(ParamsList), i++,
ParamGraph(ParamsList[i][1], ParamsList[i][2], ParamsList[i][3], ParamsList[i][4], ParamsList[i][5])
)
) << Set Window Icon("Trellis")
I even tried to replace medianCol in the Dispatch section with "Param1_Q50", to see if that was a substitution issue, expecting the first chart would get the lines and not the others, but... it didn't work!
I also tried getting reference to the report
rgb = gb << report;
rgb[TextEditBox(5)] << Set Text("Median");
But I get an error message again:
Cannot subscript Display Box in access or evaluation of 'Subscript' , rgb[/*###*/"TextEditor"]
Does anyone know how I can address the elements of these charts??
Thanks in advance!!