cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
bobmorrane
Level V

How to keep formatting and comments with New Script () ?

Hello everyone,

 

it's me again. Another day, another question :)

So I made a nice long script that creates a new data table which contains some scripts. I use the New Script () function to do this.

dt<< New script ("myscript",

// comments
//beautiful indentation
   (
       (
        (  (  instructions) )
         )
      )
 ) 

);

 

My issue is that when I check the script Inside the table dt, all comments are lost, as well as the layout, my personal style of indentation, empty lines, etc.

These scripts are intended for users who are not necesarily familiar with JSL, so I need to keep the comments and the original layout.

 

I was trying to do something like putting my scripts in a string and using Append() or Append Text() but was unsuccessful.

 

mystring = " \[ // all my
                    // script
                       ]\" ;

myscript = dt<<New Script ("my script",
//some instructions
);
myscript  << Append Text (mystring)

Unfortunately this did not work. Any ideas ? Some tricks using Expr/ Eval , etc maybe ?

 

 

 

~~Bob~~
11 REPLIES 11
XanGregg
Staff

Re: How to keep formatting and comments with New Script () ?

JSL Quote() might help:

 

New Table( "formatted script",
	New Script( "my script",
		Eval( Parse(JSL Quote(
// example
x = 1;

		Print( :column 1[1], y );
		
)			)
		)
	),
	New Column( "Column 1", Set Values( [5] ) )
)

 

bobmorrane
Level V

Re: How to keep formatting and comments with New Script () ?

well, well, well, it looks like we have a winner !

 

I love it when you spend days grinding your gears on a seemingly impossible problem and then someone reveals the solution to be a one line script :face_with_tears_of_joy:

 

thanks a lot @XanGregg :)

 

 

 

~~Bob~~

Recommended Articles