cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
bzanos
Level III

Insert Hyperlink in Text in the cells

Hi,

 

I am creating data table report, save it as html file and then distribute it to my team for review.

In the data table cells, I would like to insert hyperlink to the text (e.g. Report) in the cells, as shown in below example.

This can done easily in MS Excel.

Is there a way to do this in JMP through JSL? I am using JMP 12.

 

Hyperlink.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Insert Hyperlink in Text in the cells

I have had to do something like this year or two ago. I started by saving jmp table as html report, then taking a look at the source code and then figuring out how I should modify it. There might also be better ways to do this, but maybe this will help you (this has been tested with JMP15.2, so not sure if it will work with JMP12):

 

Approximate flow:

  1. Create new column (URL) with html a href 
  2. Create new window with outline box
  3. Append the datatable as a report to the outline box
  4. Get html string out of the outline box
  5. Using regex replace <, >, \!" with corresponding html entities 
  6. Save the modified html string to desired location

Example code:

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

dt << New Column("URL",
	Character,
	"Nominal",
	Formula("<a href=\!"file://" || :name || ".html\!" target=\!"_blank\!">"||:name||"</a>"),
);

nw = New Window("",
	ob = OutlineBox();
);
ob << Append(dt << get as report);
htmlString = ob << get html; htmlString = Regex(htmlString, "&lt;", "<", GLOBALREPLACE); htmlString = Regex(htmlString, "&gt;", ">", GLOBALREPLACE); htmlString = Regex(htmlString, "&quot;", "\!"", GLOBALREPLACE);
Save Text File("$TEMP/test.html",htmlString);

Result:

jthi_0-1626758982953.png

 

 

-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Insert Hyperlink in Text in the cells

I have had to do something like this year or two ago. I started by saving jmp table as html report, then taking a look at the source code and then figuring out how I should modify it. There might also be better ways to do this, but maybe this will help you (this has been tested with JMP15.2, so not sure if it will work with JMP12):

 

Approximate flow:

  1. Create new column (URL) with html a href 
  2. Create new window with outline box
  3. Append the datatable as a report to the outline box
  4. Get html string out of the outline box
  5. Using regex replace <, >, \!" with corresponding html entities 
  6. Save the modified html string to desired location

Example code:

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

dt << New Column("URL",
	Character,
	"Nominal",
	Formula("<a href=\!"file://" || :name || ".html\!" target=\!"_blank\!">"||:name||"</a>"),
);

nw = New Window("",
	ob = OutlineBox();
);
ob << Append(dt << get as report);
htmlString = ob << get html; htmlString = Regex(htmlString, "&lt;", "<", GLOBALREPLACE); htmlString = Regex(htmlString, "&gt;", ">", GLOBALREPLACE); htmlString = Regex(htmlString, "&quot;", "\!"", GLOBALREPLACE);
Save Text File("$TEMP/test.html",htmlString);

Result:

jthi_0-1626758982953.png

 

 

-Jarmo
ian_jmp
Level X

Re: Insert Hyperlink in Text in the cells

Not useful in the context of JMP 12, but just to point out that the Event Handler column property now allows this (and a lot more).

bzanos
Level III

Re: Insert Hyperlink in Text in the cells

Thanks Ian for the recommendation.
I will explore it if it available in JMP 12.
bzanos
Level III

Re: Insert Hyperlink in Text in the cells

Thank you.
This is great.
It works for JMP 12.