Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
zxu11
Level II

How to change table/report style in my JSL scripts? I know how to do it in JMP Preference settings.

How to change table/report style in my JSL scripts? I know how to do it in JMP Preference settings: File-Preference-Style. But I need to change the preference settings within my own JSL scripts. Is it possible? For example, I like to change Shade Alternate Table Rows( 0 ) to Shade Alternate Table Rows( 1 ), how to do it in JSL?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
txnelson
Super User

Re: How to change table/report style in my JSL scripts? I know how to do it in JMP Preference settin

Here is an example with the addition of the suggested line of code, that shows what I am talking about.  Does this help you at all?  If not, can you share your script so I can better see what you are doing.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
jmp_report =
New Window( "Big Class",
	Text Box( "Big Class" ),
	H List Box(
		Outline Box( "Big Class",
			rpt = dt << Get As Report
		)
	),

);
rpt[Tablebox(1)]<< Set Shade Alternate  Rows(1);

 

Jim

View solution in original post

Highlighted
zxu11
Level II

Re: How to change table/report style in my JSL scripts? I know how to do it in JMP Preference settin

It works perfectly! Thanks a lot!

View solution in original post

6 REPLIES 6
Highlighted
txnelson
Super User

Re: How to change table/report style in my JSL scripts? I know how to do it in JMP Preference settin

The answer to this is found in the Scripting Index

     Help==>Scripting Index==>Table Box

Here is the example from the entry for the message, "Set Shade Alternate Rows"

Names Default To Here( 1 );
New Window( "Mountains",
	tb = Table Box(
		String Col Box( "Mountain",
			{"K2", "Delphi", "Kilimanjaro",
			"Grand Teton"}
		),
		Number Col Box( "Elevation (meters)",
			{8611, 681, 5895, 4199}
		),
		Plot Col Box( "", {8611, 681, 5895, 4199} )
	)
);
tb << Set Shade Alternate Rows( 1 );
Jim
Highlighted
zxu11
Level II

Re: How to change table/report style in my JSL scripts? I know how to do it in JMP Preference settin

It seems not working for me. Here is my script:

 

dt=current data table();

 

rpt=dt<<get as report;

rpt<< Set Shade Alternate Table Rows(1);

...

 

The rpt output table has nothing changed in its style.

Highlighted
txnelson
Super User

Re: How to change table/report style in my JSL scripts? I know how to do it in JMP Preference settin

The "<< set shade alternate rows( 1 )" message, needs to be pointed at a specific Table Box().  In your script you could specify to change the first table box in the report output with the following:

rpt[Tablebox(1)]<< Set Shade Alternate  Rows(1);

Using this method, you can selectively choose which tables to change.

If you want all tables in the report output to be changed, you can use the Xpath fuction to find all Table Box()s and then apply the change

( rep << xpath(  "//TableBox" ) ) << Set Shade Alternate Rows( 1 );
Jim
Highlighted
zxu11
Level II

Re: How to change table/report style in my JSL scripts? I know how to do it in JMP Preference settin

Both ways:

rpt[Tablebox(1)]<< Set Shade Alternate  Rows(1);
( rep << xpath(  "//TableBox" ) ) << Set Shade Alternate Rows( 1 );

don't work neither (the report output is just blank/empty). When in JMP, after the report/layout table is generated, I can just right click anywhere inside the tabl, then select which table style(s) to use. But I just don't know how to do it in JSL.

Highlighted
txnelson
Super User

Re: How to change table/report style in my JSL scripts? I know how to do it in JMP Preference settin

Here is an example with the addition of the suggested line of code, that shows what I am talking about.  Does this help you at all?  If not, can you share your script so I can better see what you are doing.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
jmp_report =
New Window( "Big Class",
	Text Box( "Big Class" ),
	H List Box(
		Outline Box( "Big Class",
			rpt = dt << Get As Report
		)
	),

);
rpt[Tablebox(1)]<< Set Shade Alternate  Rows(1);

 

Jim

View solution in original post

Highlighted
zxu11
Level II

Re: How to change table/report style in my JSL scripts? I know how to do it in JMP Preference settin

It works perfectly! Thanks a lot!

View solution in original post

Article Labels

    There are no labels assigned to this post.