Very simply, I am trying to modularize some variability charts. In total there are 3-4 different parameters that I want to plot these charts for, so I need to pass in a key to the function to tell it which column to plot and let it set up some specific handling of that column. Namely, what sort of transformation that column needs to undergo as part of the plot operation.
The way I've started is to pass in a string and then use a set of conditionals to specify the name of the column to be transformed (colname) and then the striong to be applied to the transformation (yname).
I've tried several methods to do this and no matter what solution I use, I cannot get the plot to work correctly. Hard-coding the Y of the variability chart always works correctly for the given filters so I know there is data present, I just can't seem to select it using my variable approach. This is what I've tried for the var chart Y-line so far:
- Y( Transform Column( yname, Formula( Column(colname) ) ) ),
- JMP Alert: Invalid Argument (dialog box)
- Group has no data because all rows have missing values or are excluded (log window)
- Y( Transform Column( yname, Formula( Column(dt,colname) ) ) ),
- JMP Alert: Invalid Argument (dialog box)
- Group has no data because all rows have missing values or are excluded (log window)
- Y( Transform Column( yname, Formula( Column( As Column(colname)) ) ) ),
- JMP Alert: Unresolved Column 256 times (dialog box)
- "Invalid argument 256 times, One column or group has no data because all rows have missing values or are excluded (log)
- Y( Transform Column( yname, Formula( Column( As Column(dt,colname)) ) ) ),
- JMP Alert: Scoped data table access requires a data table column or variable 256 times (dialog box)
- Invalid argument 256 times, One column or group has no data because all rows have missing values or are excluded (log)
- Y( Transform Column( yname, Formula( As Column(colname) ) ) ),
- JMP Alert: Unresolved Column 267 times (dialog box)
- (no log errors)
- Y( Transform Column( yname, Formula( As Column(dt,colname) ) ) ),
- JMP Alert: Scoped data table access requires a data table column or variable 267 times (dialog box)
- (no log errors)
If it isn't obvious by my attempts, it still isn't clear to me what the difference between As Column() and Column() are. I've seen solutions on forums with either and both so I tried them all and got nowhere. The only clue I see is that when As Column() is used independently, I get a different number of access violations (267) as compared to the case where it's wrapped by Column() (256). I do know that 267 is the "correct" number of rows to be returned by that filter because hard-coding the column name in the transformation formula correctly plots 267 rows.
Additionally I've tried setting the colname variable directly to the column (colname = :R and colname = ":R") and various combinations of using those directly and/or wrapping them in combinations of the Column() and As Column() functions as well with no success.
Can anyone see what I'm doing wrong here?
Note: This exact code is untested, var names have been genericized.
//
// Build plot functions
//
var_chart = Function( {dutname, ytype, stressname, bias, ver},
{chart, ax_min, ax_max, ax_step, len, colname, yname},
ax_min = 0;
ax_max = 1;
ax_step = 0.1;
If(ytype == "r", (colname = "R"; yname = "R [Ω]"));
If(ytype == "l", (colname = "L"; yname = "L [H]"));
If(ytype == "c", (colname = "C"; yname = "C [F]"));
If(stressname == "s1", len = 1.1);
If(stressname == "s2", len = 2.2);
If(stressname == "s3", len = 3.3);
chart = Variability(
Y( Transform Column( yname, Formula( As Column(colname) ) ) ),
X( :X1, :X2, :X3, :X4 ),
Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
Std Dev Chart( 0 ),
Points Jittered( 1 ),
Show Box Plots( 1 ),
<<Set Scale( Normal, Simultaneous ),
Confidence Interval Method( Wald ),
Automatic Recalc( 1 ),
Where( :Dutname == dutname & :Len == len & :Bias == bias ),
SendToReport(
Dispatch(
{"Variability Gauge"},
"2",
ScaleBox,
{Scale( "Lin" ), Min(ax_min), Max(ax_max), Inc(ax_step), Minor Ticks( 1 )}
)
)
);
return(chart)
);