- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Collection of good/valuable scripting examples the scripters club would like to be added to the scripting index examples
In our last session the idea came up to collect good examples which may be good candidates to be added to the scripting index in JMP as examples.
Please add in the comments section your ideas with links to community posts or just adding the code as example in the comments. Be sure to specify what function the example is related to (where you would like to see this example!
We will provide all suggestions to our support team and therefore to the developers, so they can consider adding at least some of them.
Actions:
- Add your suggestions in the comment field
- kudo the ones you liked to be added
The least we get is a valuable list of example in this post, which by itself should already be very helpful.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Collection of good/valuable scripting examples the scripters club would like to be added to the scripting index examples
For New Column() & << Set Property(), please add a Link to
Writing JSL code dynamically
[alternatively, one could add the link to Substitute and Expr.
The problem: Just user who know the answer will find the answer]
Names Default to Here(1);
// Open a sample data table
dt = Open("$SAMPLE_DATA/Cleansing.jmp");
// Values previously obtained from a lookup table and assigned to variables as:
myLSL = 6;
myUSL = 8;
myTarget = 7;
// Use the variables to set the spec limits column property
Eval(Eval Expr(
Column(dt, "pH") << Set Property(
"Spec Limits",
{LSL( Expr(myLSL) ), USL( Expr(myUSL) ), Target( Expr(myTarget) ), Show Limits( 1 )}
);
));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Collection of good/valuable scripting examples the scripters club would like to be added to the scripting index examples
I always forget how Eval(), Eval Expr() and Expr() work together, so I have this page bookmarked, and I specifically use this bit of JSL from the linked page:
//Eval Expr
For( i = 1, i <= N Items(cols), i++,
Eval( Eval Expr(
dt << New Column(
"2 * " || Char( cols[i] ),
Numeric,
"Continuous",
Formula( As Column( Expr( Char( cols[i] ) ) ) * 2)
)
) )
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Collection of good/valuable scripting examples the scripters club would like to be added to the scripting index examples
For Get Environment Variable():
uname = Get Environment Variable( "USERNAME" );
from: https://community.jmp.com/t5/Discussions/computer-name/m-p/753036/highlight/true#M93482
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Collection of good/valuable scripting examples the scripters club would like to be added to the scripting index examples
In the description of for loops, add a link to data table indexing, e.g. :
https://community.jmp.com/t5/Uncharted/Data-table-subscripting/ba-p/21013
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Collection of good/valuable scripting examples the scripters club would like to be added to the scripting index examples
dt = Open("$SAMPLE_DATA/Tablet Production.jmp");
ColList = dt << Get Column Names( Continuous );
// New column
For( i = 1, i <= N Items( colList ), i++,
Eval(Substitute(
Expr(
newCol = dt << New Column(
col_Name,
Numeric,
"Continuous",
Format( "Percent", 12, 2 ),
Formula(As Column(col1) / Col_Mean )); ),
Expr(col_Name), "Ratio " || Char(colList[i]) || " vs. Col Mean",
Expr(col1),Column(dt,ColList[i]),
Expr(Col_Mean), Col mean(Column(dt,ColList[i]))
)));