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

Need help. Got some error during create interactive HTML file

I'm writing script to make file HTML (interactive) by adding data filter feature into graphs but I got some error on the these following code during the calling function save Interactive HTML()

 

Thanks for helping on this.

The error message is below attached picture. 

2022-10-28 11_24_49-Scripting Index - JMP.jpg2022-10-28 11_24_12-Shared Local Filter Batman - JMP.jpg

 

Here is my code

Names Default To Here( 1 );
dt = Open( "C:\myJSL\BigClass.csv");
app=New Window( "Shared Local Filter Batman",
	Data Filter Context Box(
		H List Box(
			Current Data Table() <<
			Data Filter( Local ),
			Platform(
				Current Data Table(),
					Bivariate( Y( :height ), X( :weight ) )
			),
			Platform(
				Current Data Table(),
				Distribution(
					Continuous Distribution(
					Column( :height ),
					Horizontal Layout( 1 ),
					Vertical( 0 )
			)
			)
			)
		)
	)
);

box = app << Run;
Show Properties( box );
Show( box );
/*create HTML */
(box << get windows)[app] << save Interactive HTML( "C:\myJSL\myiHTML.htm" );

/* Open HTML file in Chrome */
Web( "file:///C:/myJSL/myiHTML.htm", Chrome);
3 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: Need help. Got some error during create interactive HTML file

I'm using JMP16.

 

I made slight modifications to your script. box variable isn't needed when New Window is being used like this (not sure when it would be needed, application/dashboard?) and you can just save the app (new window) as interactive html.

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
app = New Window("Shared Local Filter Batman",
	Data Filter Context Box(
		H List Box(
			Current Data Table() << Data Filter(Local),
			Platform(Current Data Table(), Bivariate(Y(:height), X(:weight))),
			Platform(
				Current Data Table(),
				Distribution(Continuous Distribution(Column(:height), Horizontal Layout(1), Vertical(0)))
			)
		)
	)
);

// box = app << Run; 
// Show Properties(box);
// Show(box);
/*create HTML */
app << save Interactive HTML("$DOWNLOADS\myiHTML.html");

Web("$DOWNLOADS\myiHTML.html"); // open with default browser

 

 

-Jarmo

View solution in original post

Re: Need help. Got some error during create interactive HTML file

Hi @cpbatman

 

I couldn't help noticing that the local data filter in your script doesn't define a column to filter. 

I also noticed that you have the include mode enabled in the local data filter. 

The local data filter will not work in Interactive HTML unless a filter column is added before saving and the include mode is disabled.

 

Here is some local data filter script code that will disable the include mode and filter on the age column:

Data Filter(Local, 
Mode( Include( 0 ) ),
Add Filter( columns( :age ), Display( :age, N Items( 6 ) ) ) )

If you combine this with Jarmo's solution, your filter should work in JMP and in Interactive HTML. 

 

Please note that the behavior with Include mode disabled will be different than when it is enabled, since the filter will only be showing/hiding rows. All rows will always be included. While the points in the bivariate plot and the outliers in the boxplot will respond to the Show mode of the local data filter, the histogram and box plot will not. 

 

Note that when publishing to JMP Live or JMP Public, which also use Interactive HTML, the include mode does not need to be disabled. 

 

I hope you find this useful.

~John

 

  

 

View solution in original post

Re: Need help. Got some error during create interactive HTML file

Hi @cpbatman , 

You added the Mode and Add Filter lines to the Data Filter Context Box function rather than the Data Filter function. You also added an extra H List Box that duplicates the first. 

Here's how it should look with some minor file name changes to make it work on my computer :

Names Default To Here(1);
/* using sample data table */
dt = Open("$SAMPLE_DATA/Big Class.jmp"); // C:\myJSL\BigClass.csv");
app = New Window("Shared Local Filter Batman",
		
	Data Filter Context Box( 
		
		H List Box(
			Current Data Table() << Data Filter(Local,
				/** added code to handle data filter **/
				Mode( Include( 0 ) ),
				Add Filter( columns( :height ), Display( :height, N Items( 6 ) ) )
				/** end of added code **/
			),
			Platform(Current Data Table(), Bivariate(Y(:height), X(:weight))),
			Platform(
				Current Data Table(),
				Distribution(Continuous Distribution(Column(:height), Horizontal Layout(1), Vertical(0)))
			)
		)
		
		/** removed duplicate H List Box code **
		,
		
		H List Box(
			Current Data Table() << Data Filter(Local),
			Platform(Current Data Table(), Bivariate(Y(:height), X(:weight))),
			Platform(
				Current Data Table(),
				Distribution(Continuous Distribution(Column(:height), Horizontal Layout(1), Vertical(0)))
			)
		)
		** end of removed code **/
	)
	
);

/* exported file location changed */ 
app << save Interactive HTML("$DOWNLOADS\myiHTML.htm");
Web("$DOWNLOADS/myiHTML.htm", Chrome); // open with default browser

Since you are new at JSL scripting, here are a couple of tips that should help:

1. Right click in the JSL editor and select 'Show line numbers' to help find the lines mentioned in the embedded log(below script).

2. To find out what parameters you can pass to a function, hover over the function name and a tip should show them. To get more information on the function, right click on the function and select  'Help Scripting Index'. 

 

~John 

 

View solution in original post

6 REPLIES 6
jthi
Super User

Re: Need help. Got some error during create interactive HTML file

I'm using JMP16.

 

I made slight modifications to your script. box variable isn't needed when New Window is being used like this (not sure when it would be needed, application/dashboard?) and you can just save the app (new window) as interactive html.

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
app = New Window("Shared Local Filter Batman",
	Data Filter Context Box(
		H List Box(
			Current Data Table() << Data Filter(Local),
			Platform(Current Data Table(), Bivariate(Y(:height), X(:weight))),
			Platform(
				Current Data Table(),
				Distribution(Continuous Distribution(Column(:height), Horizontal Layout(1), Vertical(0)))
			)
		)
	)
);

// box = app << Run; 
// Show Properties(box);
// Show(box);
/*create HTML */
app << save Interactive HTML("$DOWNLOADS\myiHTML.html");

Web("$DOWNLOADS\myiHTML.html"); // open with default browser

 

 

-Jarmo

Re: Need help. Got some error during create interactive HTML file

Hi @cpbatman

 

I couldn't help noticing that the local data filter in your script doesn't define a column to filter. 

I also noticed that you have the include mode enabled in the local data filter. 

The local data filter will not work in Interactive HTML unless a filter column is added before saving and the include mode is disabled.

 

Here is some local data filter script code that will disable the include mode and filter on the age column:

Data Filter(Local, 
Mode( Include( 0 ) ),
Add Filter( columns( :age ), Display( :age, N Items( 6 ) ) ) )

If you combine this with Jarmo's solution, your filter should work in JMP and in Interactive HTML. 

 

Please note that the behavior with Include mode disabled will be different than when it is enabled, since the filter will only be showing/hiding rows. All rows will always be included. While the points in the bivariate plot and the outliers in the boxplot will respond to the Show mode of the local data filter, the histogram and box plot will not. 

 

Note that when publishing to JMP Live or JMP Public, which also use Interactive HTML, the include mode does not need to be disabled. 

 

I hope you find this useful.

~John

 

  

 

cpbatman
Level II

Re: Need help. Got some error during create interactive HTML file

Hi John, @John_Powell_JMP    thank you so much that you forecast my next issue that I'm going to see it.

Now I got the problem that you told me hahha ^^"

 

Anyway, I try to added the code that you suggested (at comment zone added code to handle data filter), but I got some error as the attached picture. Could you please kindly help. Sorry for my interrupted, I quite new for JSL.

 

Names Default To Here(1);
dt = Open("C:\myJSL\BigClass.csv");
app = New Window("Shared Local Filter Batman",
		
		Data Filter Context Box( 
		
		/** added code to handle data filter **/
		Local, 
		Mode( Include( 0 ) ),
		Add Filter( columns( :height ), Display( :height, N Items( 6 ) ) );
		/** end of added code **/
		
		H List Box(
			Current Data Table() << Data Filter(Local),
			Platform(Current Data Table(), Bivariate(Y(:height), X(:weight))),
			Platform(
				Current Data Table(),
				Distribution(Continuous Distribution(Column(:height), Horizontal Layout(1), Vertical(0)))
			)
		),
		
		H List Box(
			Current Data Table() << Data Filter(Local),
			Platform(Current Data Table(), Bivariate(Y(:height), X(:weight))),
			Platform(
				Current Data Table(),
				Distribution(Continuous Distribution(Column(:height), Horizontal Layout(1), Vertical(0)))
			)
		)
		
	)
	
);

app << save Interactive HTML("C:\myJSL\myiHTML.htm");

Web("file:///C:/myJSL/myiHTML.htm", Chrome); // open with default browser

Here is my error message.

2022-10-31 09_22_24-Scripting Index - JMP.jpg

cpbatman
Level II

Re: Need help. Got some error during create interactive HTML file

Thank you so much @jthi

It work fine after I did as you suggested.

Re: Need help. Got some error during create interactive HTML file

Hi @cpbatman , 

You added the Mode and Add Filter lines to the Data Filter Context Box function rather than the Data Filter function. You also added an extra H List Box that duplicates the first. 

Here's how it should look with some minor file name changes to make it work on my computer :

Names Default To Here(1);
/* using sample data table */
dt = Open("$SAMPLE_DATA/Big Class.jmp"); // C:\myJSL\BigClass.csv");
app = New Window("Shared Local Filter Batman",
		
	Data Filter Context Box( 
		
		H List Box(
			Current Data Table() << Data Filter(Local,
				/** added code to handle data filter **/
				Mode( Include( 0 ) ),
				Add Filter( columns( :height ), Display( :height, N Items( 6 ) ) )
				/** end of added code **/
			),
			Platform(Current Data Table(), Bivariate(Y(:height), X(:weight))),
			Platform(
				Current Data Table(),
				Distribution(Continuous Distribution(Column(:height), Horizontal Layout(1), Vertical(0)))
			)
		)
		
		/** removed duplicate H List Box code **
		,
		
		H List Box(
			Current Data Table() << Data Filter(Local),
			Platform(Current Data Table(), Bivariate(Y(:height), X(:weight))),
			Platform(
				Current Data Table(),
				Distribution(Continuous Distribution(Column(:height), Horizontal Layout(1), Vertical(0)))
			)
		)
		** end of removed code **/
	)
	
);

/* exported file location changed */ 
app << save Interactive HTML("$DOWNLOADS\myiHTML.htm");
Web("$DOWNLOADS/myiHTML.htm", Chrome); // open with default browser

Since you are new at JSL scripting, here are a couple of tips that should help:

1. Right click in the JSL editor and select 'Show line numbers' to help find the lines mentioned in the embedded log(below script).

2. To find out what parameters you can pass to a function, hover over the function name and a tip should show them. To get more information on the function, right click on the function and select  'Help Scripting Index'. 

 

~John 

 

cpbatman
Level II

Re: Need help. Got some error during create interactive HTML file

Hi John, @John_Powell_JMP   Thanks a lot for help to figure out what I am wrong in my code. Now it work fine! and so I can tweak the code suitable for my real tasks for the next step.

Anyway, also thanks for advice a couple of tips that I should follow.