- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
JMP Scripting Collapsing Whitespace in All Columns
Is there an easy way to collapse whitespace in all the columns using JMP Scripting?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JMP Scripting Collapsing Whitespace in All Columns
Hello, just in case you are asking about performing a Collapse Whitespace function on every character column to remove excess whitespaces there is a script below. I am sure there are many ways to do this but I just stole some code from the advanced log after manually recoding a column. Wasn't sure exactly what you were asking for so thought I would provide this just in case.
Names Default to Here(1);
dt = Current Data Table();
Cols = dt << Get Column Names( Character, String);
For(
i = 1, i <= N Items( Cols ), i++,
Eval(
Eval Expr(
dt << Begin Data Update;
dt << Recode Column(
Expr( Column( dt, Cols[i] ) ),
{Collapse Whitespace( _rcNow )},
Update Properties( 1 ),
Target Column( Column( dt, Expr( Cols[i] ) ) )
)
)
);
dt << End Data Update;
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JMP Scripting Collapsing Whitespace in All Columns
Try sending the message <<Optimize Display
, as shown in the Scripting Index
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JMP Scripting Collapsing Whitespace in All Columns
If you want to do this interactively,
- Select all of the columns you want to change width on
- Hold down the Shift and ALT keys
- Go to the edge border of one of the columns you have selected, and click and drag the column width to the width you want. All of the selected columns will expand or contract to your specified width
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JMP Scripting Collapsing Whitespace in All Columns
Hello, just in case you are asking about performing a Collapse Whitespace function on every character column to remove excess whitespaces there is a script below. I am sure there are many ways to do this but I just stole some code from the advanced log after manually recoding a column. Wasn't sure exactly what you were asking for so thought I would provide this just in case.
Names Default to Here(1);
dt = Current Data Table();
Cols = dt << Get Column Names( Character, String);
For(
i = 1, i <= N Items( Cols ), i++,
Eval(
Eval Expr(
dt << Begin Data Update;
dt << Recode Column(
Expr( Column( dt, Cols[i] ) ),
{Collapse Whitespace( _rcNow )},
Update Properties( 1 ),
Target Column( Column( dt, Expr( Cols[i] ) ) )
)
)
);
dt << End Data Update;
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JMP Scripting Collapsing Whitespace in All Columns
This is exactly what I'm looking for, but it didn't work for me. I got the error message below when I tried the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JMP Scripting Collapsing Whitespace in All Columns
I tweaked it, and it now works. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JMP Scripting Collapsing Whitespace in All Columns
@dn610 You may not be using JMP 16. I have noticed that when using the Recode script, in version 16 that line for Update Properties gets added. If you just delete that line for update properties the code should still work for earlier versions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JMP Scripting Collapsing Whitespace in All Columns
I'm using JMP 15, and that's exactly what I did to make it work. Thanks again!