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
watoft
Level II

HTML DOCUMENTS

Hi, 

I would like to know what are the possible ways to attach a number of HTML reports, possibly 60 to 70 in total to a main HTML Document. The individual reports will have some text, lables and JMP GRAPHS, JMP DISTRIBUTION tables. The main HTML document will be a summary or analysis of the individual reports, also contining JMP GRAPHS and the HTML document will have a text box in order to comment and summarise the analysis.

1) I could imagine a list of links to each individual HTML report. Is this feasible? 

2) Is the TEXT box on the main HTML document feasible?

Warren

4 REPLIES 4
Highlighted
Craige_Hales
Staff (Retired)

Re: HTML DOCUMENTS

There may be better ways to do this, either using Save As HTML or JMP Public or JMP Live .

 

But, here's a proof-of-concept for creating custom HTML that does what you describe. JMP creates HTML output as a complete web page. This example uses iframes to display the individual web pages within another page; the left side iframe is some sort of summary, the right side iframe some sort of subset. You should find someone that knows more about HTML than I do to put this together better.

JMP reports, side-by-side in a browser, with an index below the right side reportJMP reports, side-by-side in a browser, with an index below the right side report

path = "$temp/deletmeHTML/";
Create Directory( path );

// make some sample HTML

dt = Open( "$sample_data/big class.jmp" );

// the LEFT side output

overview = Distribution(
	Continuous Distribution( Column( :weight ), Quantiles( 0 ), Summary Statistics( 0 ) ),
	Nominal Distribution( Column( :age ), Frequencies( 0 ) )
);

overview << Save  HTML( path || "overview.html" );
overview << closewindow;

// the RIGHT side output

links = "";
For( global:age = Col Min( dt:age ), global:age <= Col Max( dt:age ), global:age += 1,
	agegroup = Distribution( Continuous Distribution( Column( :weight ), Quantiles( 0 ), Summary Statistics( 0 ) ), where( dt:age == global:age ) );
	report(agegroup)[Outlinebox(1)]<<settitle("age group "||char(global:age));// put something useful in place of "distributions"
	agegroup << Save  HTML( path || "age" || Char( global:age ) || ".html" );
	agegroup << closewindow;

	// build the links for the document below
	
	links = links || "\[
	<a href="#" id="age]\" || Char( global:age ) || "\[" onClick="change(this.id)">]\" || Char( global:age ) || "\[</a>
	]\";

);
Close( dt, nosave );

// build a container page that embeds JMP output via iframe
// https://www.sitepoint.com/community/t/how-to-change-iframes-content/1475/3

html = // this is a proof of concept, not great HTML...
"\[
<html>
  <head>
	<title>JSL+HTML example</title>
	<style>
		iframe{
			width: 40%; height: 500px;
			border: 2px solid #ccc;
		}
	</style>	
	<script>
		function change(newPage){
			document.getElementById('myframe').src=newPage + ".html";
		}
	</script>
  </head>
  <body>
	<iframe src="overview.html"></iframe>
	<iframe src="age17.html" id="myframe" ></iframe>

	<div align="center">
	  <span id="menu">
]\"
 || links || "\[
	  </span>
	</div>
  </body>
</html>
]\";
htmlfile = Save Text File( path || "index.html", html );

// launch the web page. Your browser might think pages loaded from your computer
// come from different sites (chrome). Some iframe tricks for sizing do not work locally.
Run Program(
	Executable( "CMD.EXE" ), // probably use default browser on win
	Options( {"/a", "/q", "/c", htmlfile} ),
	ReadFunction( Function( {this}, Write( this << read ) ) )
);

The RunProgram at the end is for Windows; using Open(htmlfile) might work better, but it was using IE rather than my preferred browser. Using SaveAsHTML was confusing because the selection does not work across frames. I did not find iframe scripting examples for sizing the iframes that worked locally on chrome on my local machine. They might work fine from a proper site.

Craige
Highlighted

Re: HTML DOCUMENTS

Craig's answer is excellent, but I wanted to make sure you knew about JMP's capability to build a Web Report page with an index to multiple interactive HTML files in case it may offer an acceptable solution.  You can read about it here: https://www.jmp.com/support/help/en/15.2/index.shtml#page/jmp/create-a-web-report-2.shtml

The link also describes the JMP Public and JMP Live options Craig suggested. It won't give you exactly what you describe, but it won't require any HTML programming. 

 

If you prefer to use iframes as Craig suggested, there's another example with some iframe use here How to add HTML links to JMP interactive HTML files .

Hope this helps.

~John

Highlighted
watoft
Level II

Re: HTML DOCUMENTS

Hi John & Craig,

Thanks for coming back to me and your interest.

OK, so if I develop standard analysis in JMP which produce JMP GRAHPS and JMP DISTRIBUTION TABLES and other analysis in a standard format from a database that I can update weekly. Can the Web Report developed as a standard Template which I can just update?

Warren
Highlighted

Re: HTML DOCUMENTS

Yes, you can automate weekly publishing using JSL.

 

Look for the function New Web Report( ) in the Scripting Index.

It can be used to build the Web Report and add individual HTML reports with descriptions like when you use File>Publish.

 

You can learn more about automating in Automated Report Creation: From Data Import to Publication (2019-US-45MP-184) .

It shows how to Publish to JMP Public, but the same methods can be used to publish to a local or shared file system. 

~John

 

Article Labels