Choose Language Hide Translation Bar
TreiderBest
Community Trekker

Does web( ) inside Button Box( ) take a string variable when publishing report to HTML?

workweek = Substr( Char( year ), 3, 2 ) || Char( week );  // workweek = 1852 (52nd week of 2018)
hlb1 = H list Box(
	tb1 = Text Box("*** Click Here for Teapot Yield Details ----->  "),
	teapot_link = "http://teapots.com/user/ltreider/ww/ww" || workweek || "/teapot.html";  // teapot_link = "http://teapots.com/user/ltreider/ww/ww1852/teapot.html"
	Button Box("Teapot Yield", Web( teapot_link ), <<underlinestyle)  // *** can put in variable or manually type out string on this line ***     <-----
);
Overview_Report << append(hlb1);
overview_fname = "\\teapot_server\ltreider\public_html\ww\ww" || workweek || "\yield.html" ;  // place to save overview file
Overview_Report << SaveHTML(overview_fname);  // This line chokes if marked line above is fed a string variable inside web( ) <-----

I have an report that needs to generate each work week, so to automate it, I'm trying to create a link that includes the work week.When I try Button Box( "Yield", Web("Type out the whole path in here"), <<underlinestyle) it works fine, but when I assign that path string to a variable and plug the variable in there, there's a problem converting the JMP report to HTML.

 

There are no problems with the JMP report inside JMP. In fact, whether I use a manually typed path string or a variable containing the path string, the Overview_Report that I view in JMP is identical and all the links work as intended.

 

The problem is using SaveHTML. If I try to use a variable instead of typing out the string in the button box, the log gives me Unknown{205} and it won't put that link on the HTML report. The HTML report stops before the link, and nothing else that is appended on the JMP report ends up on the HTML report. 

I'm using JMP 13 still. Is there some work around I can use to generate new links every week?

0 Kudos
2 ACCEPTED SOLUTIONS

Accepted Solutions
gzmorgan0
Super User

Re: Does web( ) inside Button Box( ) take a string variable when publishing report to HTML?

@TreiderBest, from the snippet of your program it appears you are adding a buttonbox to a report.  Three items to note:

  • #1: As written, the report you created has the button and it works in this session of JMP.  However, it will not work in a different session. Write click on your web link, select Edit, then Set Script. You should see the embedded picture below. Note in a published .jrn file opened by a different user, or by you in a different session, teapot_link is unknown.

image.png

  • #2: You need to ensure the value of the variable teapot_link is within the JMP Web() function.  The JSL snippet below (see below) will ensure the value of your script variable is there instead of the variable name.

 

hlb1 = H list Box(
	tb1 = Text Box("*** Click Here for Teapot Yield Details ----->  "),
	teapot_link = "http://teapots.com/user/ltreider/ww/ww" || workweek || "/teapot.html"; 
// teapot_link = "http://teapots.com/user/ltreider/ww/ww1852/teapot.html" Eval(Eval Expr(Button Box("Teapot Yield", Web( Expr(teapot_link) ), <<underlinestyle) ))
// *** can put in variable or manually type out string on this line *** <----- );

image.png

  • #3: This fix will work on a stored .jrn file shared by others.  However, JMP buttons and JMP functions are not recognized by HTML commands.  Even if saved as Interactive HTML.  

View solution in original post

gzmorgan0
Super User

Re: Does web( ) inside Button Box( ) take a string variable when publishing report to HTML?

Oops, my bad.  Ignore my statement in #3 that stated it would not work on a web page.  My modified script did not have the http://  prefix so the href interpretted it as a file not a link. 

 

Using #2 should fix your problem.

View solution in original post

0 Kudos
4 REPLIES 4
TreiderBest
Community Trekker

Re: Does web( ) inside Button Box( ) take a string variable when publishing report to HTML?

I don't know how to edit my above post, but I also tried saving the report to a jrn and then saving the jrn as html and that caused the same error. I'm on the verge of using another script to edit this .jsl file every week to change the workweek variable...
0 Kudos
gzmorgan0
Super User

Re: Does web( ) inside Button Box( ) take a string variable when publishing report to HTML?

@TreiderBest, from the snippet of your program it appears you are adding a buttonbox to a report.  Three items to note:

  • #1: As written, the report you created has the button and it works in this session of JMP.  However, it will not work in a different session. Write click on your web link, select Edit, then Set Script. You should see the embedded picture below. Note in a published .jrn file opened by a different user, or by you in a different session, teapot_link is unknown.

image.png

  • #2: You need to ensure the value of the variable teapot_link is within the JMP Web() function.  The JSL snippet below (see below) will ensure the value of your script variable is there instead of the variable name.

 

hlb1 = H list Box(
	tb1 = Text Box("*** Click Here for Teapot Yield Details ----->  "),
	teapot_link = "http://teapots.com/user/ltreider/ww/ww" || workweek || "/teapot.html"; 
// teapot_link = "http://teapots.com/user/ltreider/ww/ww1852/teapot.html" Eval(Eval Expr(Button Box("Teapot Yield", Web( Expr(teapot_link) ), <<underlinestyle) ))
// *** can put in variable or manually type out string on this line *** <----- );

image.png

  • #3: This fix will work on a stored .jrn file shared by others.  However, JMP buttons and JMP functions are not recognized by HTML commands.  Even if saved as Interactive HTML.  

View solution in original post

gzmorgan0
Super User

Re: Does web( ) inside Button Box( ) take a string variable when publishing report to HTML?

Oops, my bad.  Ignore my statement in #3 that stated it would not work on a web page.  My modified script did not have the http://  prefix so the href interpretted it as a file not a link. 

 

Using #2 should fix your problem.

View solution in original post

0 Kudos
TreiderBest
Community Trekker

Re: Does web( ) inside Button Box( ) take a string variable when publishing report to HTML?

Thank you! That worked perfectly. I just edited my script with the changes you noted above in #2 and it's publishing to the web just fine now.