cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
lala
Level VII

How to automatically write code containing /**/ to JSL?

For example, I use the following JSL to automatically generate a table script file in a data table.
But how to write the code containing /**/ into the script file of this table?

Thanks!

dt=Open("$SAMPLE_DATA/Big Class.jmp");
Eval(Parse("dt<<new script(\!"test\!",  dt<<Select Where(age==12);d3=dt<<Subset(Output Table(\!"age12\!"),Selected Rows(1),selected columns(0));try(d3<<Delete Table Property(\!"Source\!"));  );"));

2024-06-30_17-35-05.png

 

  • For example, insert code like /**/

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Eval(
	Parse(
		"dt<<new script(\!"test\!",  dt<<Select Where(age==12);d3=dt<<Subset(Output Table(\!"age12\!"),Selected Rows(1),selected columns(0));try(d3<<Delete Table Property(\!"Source\!")); /*d3<<Sort(By( height ),Order(Descending),replace table);*/ );"	
	)
);
3 REPLIES 3
lala
Level VII

Re: How to automatically write code containing /**/ to JSL?

Achieve the effect

2024-06-30_17-48-47.png

jthi
Super User

Re: How to automatically write code containing /**/ to JSL?

I'm not sure if this is directly possible, but you can use workaround combining Eval(Parse(JSL Quote)))

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

dt << New Script("Test",
	Eval(Parse(JSL Quote(
		/*
			Current Data Table() << Sort By(:height);
		*/
		show(1);
	)));
);

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

Preserve comments and whitespace in JSL code attached to data table 

-Jarmo
lala
Level VII

Re: How to automatically write code containing /**/ to JSL?

Thanks!

Looks like it has to be this way

2024-06-30_18-33-07.png