Hello all,
I want to script the "By" in a call to the Pareto function. I notice that Pareto plots plotted "By" something look like this:
Pareto Plot(Cause( :SBIN_NAM ), X( :Insertion ), Where( :lot_id == "4LU31HFN00_E95029" ))
The "Where" implements the "By" field from the Pareto function dialog box.
So, I have a JMP script where I want to plot Pareto plots by a column called "lot_id". However, I want the script to be general so I don't know what the "lot_id"s will be ahead of time. So, what values get passed into "Where"- is determined at run-time by whatever lot_id's actually exist in the data table.
At first, I created a list of all the lot_id's called "listOfLotIDs" in the data table and tried the common-sense approach. This did not work:
For( i = 1, i <= N Items( listOfLotIDs ), i++,
Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == listOfLotIDs[i] ));
);
After some time I came to believe that my code didn't work because, for some reason lost to me, the value passed to the "Where" function must be defined within the parentheses with actual quotation marks- you cannot just pass it a string variable. So, I tried another variant:
For( i = 1, i <= N Items( listOfLotIDs ), i++,
sEval = "Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"" || listOfLotIDs[i] || "\!"))";
eval(Parse(sEval));
print("PRINT OUTPUT: " || sEval);
);
I believe the "parse" function compiles a JMP script and the "eval" function runs a piece of compiled JMP script? However, this ALSO does not work. I included the print() of the string just to make sure I was assembling the string correctly. This is what the log says:
Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFN00_E95029-)' : One or more columns have missing values on all rows.
"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFN00_E95029\!"))"
Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFO00_E93847-)' : One or more columns have missing values on all rows.
"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFO00_E93847\!"))"
Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFP00_E93981-)' : One or more columns have missing values on all rows.
"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFP00_E93981\!"))"
Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFQ00_E95030-)' : One or more columns have missing values on all rows.
"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFQ00_E95030\!"))"
Error for Pareto Plot on data table 'Subset of 4LU31HFN00_E95029,4LU31HFO00_E93847,4LU31HFP00_E93 20 Where(lot_id == -4LU31HFR00_E94699-)' : One or more columns have missing values on all rows.
"PRINT OUTPUT: Pareto Plot( Cause( :SBIN_NAM ), X( :Insertion ), Per Unit Rates( 1 ), Show cumulative Percent Curve( 0 ), Where(:lot_id == \!"4LU31HFR00_E94699\!"))"
So what in the world is wrong? How did my escaped quotation marks (\!") get turned into dashes "-"?! Please help.
By the way, the forum is claiming it removed "invalid HTML" from my message body, just beware, some of the code or error messages may be garbled.