- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How to folding the code?
I follow the guideline fold the code, but after click it still not fold, don't know why.
How to operate through JMP or how to use script to fold the content we want?
//fold below arguments as one group
dt1 << Delete Rows( 10 ); //deletes row 10
dt1 << Delete Rows( {11, 12, 13} ); //deletes rows 11-13
dt1 << Delete Rows( 8 :: 25 ); //deletes first 20 rows
dt1 << Delete Rows( [1 2 3] );
dt1 << Delete Columns( 3 );
dt1 << Delete Columns( {3, 4} ); //deletes 3,4 columns
//fold below arguments as one group
dt = New Table( "test",
addrows( 3 ),
New Column( "lot", character, values( {"K1", "K2", "K3"} ) ),
New Column( "SPCval", numeric, values( {} ) ),
New Column( "EPval", numeric, values( {1, 2, .} ) ),
New Column( "lotcomment", character, values( {} ) ),
);
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to folding the code?
Code folding recognizes Expressions and Functions. See below
//fold below arguments as one group
zippy = Expr(
dt1 << Delete Rows( 10 ); //deletes row 10
dt1 << Delete Rows( {11, 12, 13} ); //deletes rows 11-13
dt1 << Delete Rows( 8 :: 25 ); //deletes first 20 rows
dt1 << Delete Rows( [1 2 3] );
dt1 << Delete Columns( 3 );
dt1 << Delete Columns( {3, 4} ); //deletes 3,4 columns
//fold below arguments as one group
dt = New Table( "test",
addrows( 3 ),
New Column( "lot", character, values( {"K1", "K2", "K3"} ) ),
New Column( "SPCval", numeric, values( {} ) ),
New Column( "EPval", numeric, values( {1, 2, .} ) ),
New Column( "lotcomment", character, values( {} ) ),
);
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to folding the code?
Adding a little to the reply from @txnelson, you can also add your own folding markers. The JMP Help is always a good resource.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to folding the code?
Code folding recognizes Expressions and Functions. See below
//fold below arguments as one group
zippy = Expr(
dt1 << Delete Rows( 10 ); //deletes row 10
dt1 << Delete Rows( {11, 12, 13} ); //deletes rows 11-13
dt1 << Delete Rows( 8 :: 25 ); //deletes first 20 rows
dt1 << Delete Rows( [1 2 3] );
dt1 << Delete Columns( 3 );
dt1 << Delete Columns( {3, 4} ); //deletes 3,4 columns
//fold below arguments as one group
dt = New Table( "test",
addrows( 3 ),
New Column( "lot", character, values( {"K1", "K2", "K3"} ) ),
New Column( "SPCval", numeric, values( {} ) ),
New Column( "EPval", numeric, values( {1, 2, .} ) ),
New Column( "lotcomment", character, values( {} ) ),
);
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to folding the code?
Adding a little to the reply from @txnelson, you can also add your own folding markers. The JMP Help is always a good resource.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to folding the code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to folding the code?
Is this can realize by "Folding Keywords"? I am not so understand "Folding Keywords" mean.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to folding the code?
I see this script has no Expr() expression, but fold the needed content together.
Do you know how to group all the needed group by one time? Is "O-dtManu" is the "Folding Keywords". ?
Can you show a example of how to realize below fold job?
****You can use below 3 group as a example show to me. Thank you very much.
Names Default To Here( 1 );
Print( "load Func_DT.jsl-------------------" );
New Namespace(
"O_dtManu"
);
//close files with similar names
O_dtManu:closefile = Function( {fn},
{Default local},
Try( Close( Data Table( fn ), nosave ) );
For( i = 2, i < 30, i++,
Try( Close( Data Table( fn || " " || Char( i ) ), nosave ), Break() )
);
);
O_dtManu:closefilelist = Function( {fnlist},
{Default local},
ncnt = N Items( fnlist );
For( i = 1, i <= ncnt, i++,
fn = fnlist[i];
Try( Close( Data Table( fn ), nosave ), Try( fn << close window ) );
For( j = 2, j < 30, j++,
Try( Close( Data Table( fn || " " || Char( j ) ), nosave ), Break() )
);
);
);
//fill missing cell with 0
O_dtManu:fill_miss_0 = Function( {dt, start_col, fillin = 0},
{Default Local},
ncnt = N Cols( dt );
For( k = start_col, k <= ncnt, k++,
dt_col_type = Column( dt, k ) << get data type();
If( dt_col_type == "Numeric",
For( j = 1, j <= N Rows( dt ), j++,
If( Is Missing( Column( dt, k )[j] ),
Column( dt, k )[j] = fillin
)
)
);
);
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to folding the code?
Hi @Theresa,
As both @txnelson and @ian_jmp stated previously JMP will use informative or "keywords" to fold the code at or on your preferred location within the script in addition to the defaults of Expr and Function.
For example, if you would like to fold your code on words, such as, "If", "For", "For Each Row", "While", "Try", "New Window", "V List Box", "H List Box" or even "O_dtManu" then place the words in a JSL list { } and save as jmpKeywords.jsl.
The jmpKeywords.jsl file will need to be saved to a particular directory depending on your OS in order for JMP to apply the code folding to your preferred folding words.
custom code folding keywords
result after applying custom code folding keywords
The next time you start JMP and launch your script the new locations for the code folding should be applied.
cheers,
Stan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
How to stop code folding
In Script Editor preferences, code folding in unchecked. Yet every script I open is folded in the middle so bottom half of the editor window is blank. I want to see the entire window of code. If I drag the fold to the bottom, save, reopen, the fold is there again.
How can I turn off code folding? JMP Pro 15.2, Mac.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to stop code folding
Is this really a folding issue? It sounds to me like you might have the embedded log turned on. Could you share a screen capture to confirm? If it is the embedded log, right-click in the scripting window and uncheck the Show Embedded Log option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: How to stop code folding
Thank you Dan! That was it, as the attached screen clip shows. I hope someone adds that tip to the help on code folding- how to turn it off. -Rick