Subscribe Bookmark RSS Feed

URL in report via JSL?

hardner

Community Trekker

Joined:

Nov 13, 2012

I want to put a link to a URL into a report using JSL.  Really my goal is to then save the report as HTML and have a page with links to other pages created by JMP, a kind of directory of JMP reports that have been saved as HTML.

I do see that I can use outlinebox<<addurlreference() and the link is live even after the report is saved as HTML and becomes its own web page.  so far so good EXCEPT that addURLreference seems to only pop up a dialog for me to manually paste the URL and link name into (?!).  Is there no way to pass it those values in the script?  I tried various formats for possible arguments to addURLreference unsuccessfully and the documentation just says this "Brings up the menu to add a URL to the OutlineBox".  I feel like I must be missing something obvious in how to script adding a URL to a report.

I'm using JMP11.  Appreciate any inputs.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

All the commands under Append Item for an outline box are interactive. However, you can add button boxes that take a web command entirely through JSL, and they will also work when saved as html. This example adds one link to the 2 subordinate outline boxes. You could add more - I would prepend a v list box to the outline box, and then append button boxes to the v list box.

New Window( "Example",

     ob = Outline Box( "Outline Box",

          V List Box(

               ob2 = Outline Box( "Outline Box 2",

                    H List Box(

                         Text Edit Box( "Top Left" ),

                         Text Edit Box( "Top Right" )

                    )

               ),

               ob3 = Outline Box( "Outline Box 3",

                    H List Box(

                                        Text Edit Box( "Bottom Left" ),

                      Text Edit Box( "Bottom Right" )

                    )

               )

          )

     )

);

// buttons

bb1 = Button Box("JMP Community", Web("https://community.jmp.com"), <<underlinestyle);

bb2 = Button Box("JMP Website", Web("https://www.jmp.com"), <<underlinestyle);

// add them to the outline

ob2 << prepend(bb1);

ob3 << prepend(bb2);

Hope this gets you closer to what you wanted.

8 REPLIES
Solution

All the commands under Append Item for an outline box are interactive. However, you can add button boxes that take a web command entirely through JSL, and they will also work when saved as html. This example adds one link to the 2 subordinate outline boxes. You could add more - I would prepend a v list box to the outline box, and then append button boxes to the v list box.

New Window( "Example",

     ob = Outline Box( "Outline Box",

          V List Box(

               ob2 = Outline Box( "Outline Box 2",

                    H List Box(

                         Text Edit Box( "Top Left" ),

                         Text Edit Box( "Top Right" )

                    )

               ),

               ob3 = Outline Box( "Outline Box 3",

                    H List Box(

                                        Text Edit Box( "Bottom Left" ),

                      Text Edit Box( "Bottom Right" )

                    )

               )

          )

     )

);

// buttons

bb1 = Button Box("JMP Community", Web("https://community.jmp.com"), <<underlinestyle);

bb2 = Button Box("JMP Website", Web("https://www.jmp.com"), <<underlinestyle);

// add them to the outline

ob2 << prepend(bb1);

ob3 << prepend(bb2);

Hope this gets you closer to what you wanted.

ian_jmp

Staff

Joined:

Jun 23, 2011

Adding to Melanie's reply, and given the 'save as HTML' part of the requirement, you may also need to do something like this:

// Make a window with a link and save the html file

nw = NewWindow("Web Link", ButtonBox("Press Me", Web("www.jmp.com")));

fileName = "$DESKTOP/JMP.html";

nw << SaveHTML(fileName);

nw << CloseWindow;

// Read the html file in, update the <A HREF> tag, and save it back

lf = LoadTextFile(fileName);

lf = Munger(lf, 1, "A HREF=\!"www", "A HREF=\!"http://www");

SaveTextFile(fileName, lf, Mode("replace"));


Perhaps there is a better way now, but I've used this with older versions of JMP.

hardner

Community Trekker

Joined:

Nov 13, 2012

Thanks for the answers.

In the meanwhile I did a different thing which was to just create the html for a really basic page of links as text in my script and did savetextfile(path) with .html suffix on the filename. 

I had thought using the web() function in a button would look odd and/or take up a lot of space but actually it just looks like a link, not a button at all, and is a good solution.  With saveHTML it looks just like my basic html version actually but with saveinteractiveHTML it's formatted a little nicer.  I may redo with that. In any case this will be useful if I want to put a link on a more complicated JMP report page alongside other JMP content.

And Ian, it worked directly for me with nw<<saveHTML(path) or nw<<saveinteractiveHTML(path) but thanks for that tip.

ian_jmp

Staff

Joined:

Jun 23, 2011

I should have said that I (mostly) use a Mac, so it looks like there is an OS dependance.

hardner

Community Trekker

Joined:

Nov 13, 2012

Should have mentioned that I am on Windows. Thanks!

hardner

Community Trekker

Joined:

Nov 13, 2012

Here's a followup question.

Adding a ButtonBox with web() in it works!  But web() appears to have no options associated with it. What I used it for was to create a directory page for a set of separate HTML reports and then to add "back to directory" links on those pages.   But those links all open up in new windows so browsing around the reports ends up leaving many browser tabs open.  

I'm guessing the answer for this is along the lines of Ian's suggestion:  I could learn how to modify the html to make the difference of opening a new window or not and then modify the text of the html which JMP creates.  I'll look into that but would be glad to know if there is actually any built-in option that would impact that.  Also maybe that's a suggestion for future (if JMP12 doesn't already have more features for this):  save as HTML would be a lot more useful if some basic things were easier to add to the pages and the main thing on my mind right now is links to let you navigate among pages so they can be seamlessly incorporated in a web site.

melaniedrake

Staff

Joined:

May 30, 2014

I'm not sure about the standard html output - that might work. However, for the interactive html output, it won't. The scripts that control everything to make it interactive override any target you might set in your link to open in a new tab/window.

hardner

Community Trekker

Joined:

Nov 13, 2012

Thanks.  I do see now how to edit the html. ( It's target="" instead of target="_blank" ) Looks like I'd have to fiddle around if I wanted to do it for only specific links but to turn it off all over the page seems easy enough.