Hi all,
im still new to JMP scripting. I need help to create a formula to make the value as a variable but with its own name. What i mean is as below. So, i want to create a formula that can make column 4 below as a variable for distribution graph.
it is like Plastic = 0.424542
the problem right now is the formula name will be in the same which is t4 = :TYPE;:MIN;. So if i want to plot the min value for plastic in the distribution graph, it will take the min value for rock as the formula for rock is also t4.
so, how i can make the formula so that the variable value become
Plastic = :TYPE;:MIN;
Paper = :TYPE;:MIN;
and so on, then it can be independant variable already. really appreciated if someone can help on this. i have look in the internet for few hours already.
The code that I provided should work for as many TYPE values as it finds in the data table.
The code I wrote should work with as many TYPE values as it finds in the data table. If it does not, it is an error, and the code needs to be corrected.
Hi Jim,
Yes, it works for as many TYPE value in the column but when come to the plotting the distribution graph i still need to manually plot it.
Is it possible to make it automatically plot the distribution graph after it has done calculating all the limit for all TYPE value? i have tried manually plotted the graph to export out the script but seems like everything is hardcoded to the TYPE value in the example table that i gave here only.
The TYPE value also will be different from time to time. So, i need to avoid the hardcoded line in the JSL.
The code I supplied should be generating the distributions too.
Can you please attach a copy of the data table you are running against, so I can see what the issue is?...If you look into the log file, you should also see what the issue is.
Hi Jim,
here i attached the table to run the code that you gave with just some modification. If you run the script that you wrote in here, the distribution graph will not generate automatically.
i have checked the log and try to debug what is wrong with it but seems like i cannot find it why it is complaining there is an error. it looks fine to me.
the error is like below:
Unexpected end of input. Perhaps there is a missing "," or ")".
Trying to parse arguments of function "Distribution".
Line 2 Column 560: ...Normal Quantile Plot(1));►...
It was my error, I left out a ")". Try this code
Names Default To Here( 1 );
dt = Current Data Table();
// Only one set of Spec Limits per column can be set,
// therefore split the data into separate columns
// and set the separate limits for each column
dtSplit = dt << Split( Split By( :TYPE ), Split( :NUMERIC_RESULT ), Sort by Column Property );
// Get the names of the generated columns
colList = dtSplit << get column names( string );
// Loop across the columns and create the spec limits for each column
For( i = 1, i <= N Items( colList ), i++,
Eval(
Substitute(
Expr(
__col__ << set property(
"spec limits ",
{LSL( __LSL__ ), USL( __USL__ ), show limits( 1 )}
)
),
Expr( __col__ ), Parse( "dtSplit:" || colList[i] ),
Expr( __LSL__ ),
Eval(
Parse(
"col mean(dtSplit:" || colList[i] || ")-6*col std dev(dtSplit:" || colList[i
] || ")"
)
),
Expr( __USL__ ),
Eval(
Parse(
"col mean(dtSplit:" || colList[i] || ")+6*col std dev(dtSplit:" || colList[i
] || ")"
)
)
)
)
);
// Create a literal string that contains the JSL required to
// generate the Distributions
theExpr = "Distribution(
Arrange in Rows( 1 ),";
theExpr = theExpr || Char(
Substitute(
Expr(
Continuous Distribution(
Column( __col__ ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Normal Quantile Plot( 1 )
)
),
Expr( __col__ ), Parse( "dtSplit:" || colList[1] )
)
);
For( i = 2, i <= N Items( colList ), i++,
theExpr = theExpr || "," || Char(
Substitute(
Expr(
Continuous Distribution(
Column( __col__ ),
Horizontal Layout( 1 ),
Vertical( 0 ),
Normal Quantile Plot( 1 )
)
),
Expr( __col__ ), Parse( "dtSplit:" || colList[i] )
)
);
);
theExpr = theExpr || ");";
// Run the generated code
Eval( Parse( theExpr ) );